Re: [PyQt] how to use the button to control the program

2013-08-08 Thread 吉文
Hello,Dave, thank you very much for helping me, I am so sorry for replying later, I did the hardware of my project in these days. According to your hints, I changed my code, but when I click the start button, the program is dead, no any response. The following is my code. import sys from PyQt4

Re: [PyQt] how to use the button to control the program

2013-08-08 Thread David Hoese
Hi Harry, Sorry, I think you misunderstood me. When I said you might be able to use a loop that didn't return I meant you could use it with a QTimer...BUT I had time to try this and it doesn't work. Before I give you more hints I'll say it again, research the Qt Event Loop, but at this point this

Re: [PyQt] how to use the button to control the program

2013-07-31 Thread 吉文
Hi, Dave, thank you very much for helping me. I am a newcomer to pyqt4, so maybe my questions are low-level.Thanks again. If the function does not have returns, can the button connect the function? The newtime function realizes a loop to change the time every 1s, there is no return. I want to

Re: [PyQt] how to use the button to control the program

2013-07-31 Thread David Hoese
The way a timer works, especially the singleShot you are using, is that once it is time to act it calls the function pointer you've provided. You *must* provide a callable. Every tick of the timer is just calling that callable with no parameters. You could provide a function pointer to a