Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-28-2008, 10:42 AM   #1
LQ Newbie
Registered: Nov 2007
Distribution: gentoo, deb
Posts: 16

Rep: Reputation: 0
Python/PyQt4 - Newbie Structure question

Ok i've been playing with PyQt4
i have made the following app that works fine:

#!/usr/bin/env python 

import sys
import time
from PyQt4 import QtGui, QtCore

class MainWindow(QtGui.QWidget):
    def __init__(self):
    def buildWindow(self, parent=None):
    	QtGui.QWidget.__init__(self, parent)
        self.setGeometry(150, 100, 800, 600)
        self.setWindowTitle('::System Log::')
        quitBtn = QtGui.QPushButton('close', self)
        quitBtn.setGeometry(720, 550, 60, 40)
        self.connect(quitBtn, QtCore.SIGNAL('clicked()'),
            QtGui.qApp, QtCore.SLOT('quit()'))
        self.logwidget = QtGui.QTextEdit('', self)
        self.logwidget.setGeometry(5, 5, 790, 540)
        self.logwidget.append('Welcome Jerks!')

    def LogParse(self):
        logfile = open('/var/log/syslog', 'r')
        for line in logfile:

app = QtGui.QApplication(sys.argv)
mainwindow = MainWindow()
However im confused about how it is exectued. I would like see the main window and then run 'LogParse()' to fill the QTextEdit widget. As is the main window doesn't appear until after 'LogParse' runs. Ultimately i want 'LogParse' inside a 'while' loop with a sleep() to update the contents of the QTextEdit widget every few seconds.
I've missed something fundamental here and cant seem to rearange things to work this way.
Can someone show me what that might look like?
Thanks in advance


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
python exception like structure with a timer shanenin Programming 4 08-20-2005 11:44 AM
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 05:23 AM
python call function in same file(very newbie question) rmanocha Programming 2 11-21-2004 01:04 AM
newbie file structure questions wogga Linux - Hardware 2 06-08-2004 07:19 AM
newbie python question: doing more than one thing in a for loop SerfurJ Programming 1 03-18-2004 11:14 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:19 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration