[PyQt] Problem with pyqt (python 2.6)

rosso rossi emilio84music at yahoo.it
Thu May 6 11:14:23 BST 2010


Hello everybody,

I'm writing a small interface with python 2.6.5 and pyqt 4.7.3.

I'm testing this interface on windows, but i have the same problem in linux (windows and linux are 32-bit OS).

So... This is my problem:

In my interface i have 1 qpushbutton (self.Button) and 2 QLineEdit (Edit1, and edit2)

i connected qpushbutton with a funzion (pressbutton)

def pressbutton(self):
     self.thread = threading.Thread( target=self.Thcall )
     self.thread.start()

def Thcall(self):
        while(True):    
            self.t = Timer(10, self.Read) #10 seconds
            self.t.start()
            self.t.join()

def Read(self):
        Edit1.setText("a string")
        Edit2.setText("another string")
        #now here i have 500 linees of code, i read from serial port and compute these datas. It's take about 500ms
        Edit1.setText("finished")
        Edit2.setText("finished")



as you can see my program is very simple (i omitted the first part, where i initialize Qwidget and move them in my window). But when my program enter in self.Read my windows freeze for some time (< 1 second). This is the first problem. Why it freeze?

Second problem: If i switch from antoher program (for example firefox) and my program, this crash....

Is there some error in my code?

i want that when user push a button, my program will call function Read every 10 seconds FOREVER....

Thank you very much and sorry for my bad english




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100506/f3890a98/attachment-0001.html>


More information about the PyQt mailing list