<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hello everybody,<br><br>I'm writing a small interface with python 2.6.5 and pyqt 4.7.3.<br><br>I'm testing this interface on windows, but i have the same problem in linux (windows and linux are 32-bit OS).<br><br>So... This is my problem:<br><br>In my interface i have 1 qpushbutton (self.Button) and 2 QLineEdit (Edit1, and edit2)<br><br>i connected qpushbutton with a funzion (pressbutton)<br><br>def pressbutton(self):<br> self.thread = threading.Thread( target=self.Thcall )<br> self.thread.start()<br><br>def Thcall(self):<br> while(True): <br> self.t = Timer(10, self.Read) #10 seconds<br>
self.t.start()<br> self.t.join()<br><br>def Read(self):<br> Edit1.setText("a string")<br> Edit2.setText("another string")<br> #now here i have 500 linees of code, i read from serial port and compute these datas. It's take about 500ms<br> Edit1.setText("finished")<br> Edit2.setText("finished")<br><br><br><br>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?<br><br>Second problem: If i switch from antoher program (for example firefox) and my program, this crash....<br><br>Is there
some error in my code?<br><br>i want that when user push a button, my program will call function Read every 10 seconds FOREVER....<br><br>Thank you very much and sorry for my bad english<br><br></td></tr></table><br>