Jun-04-2017, 12:17 PM
A windowed application has an "event loop". Conceptually it polls a queue of events (mouse and keyboard, mostly), processes the event, and then polls for the next event. A good deal of the events is processed by the UI support (the Qt library, in your case), but some are forwarded to your app (_set_alarm_btn_clicked). If your code doesn't return quickly, the event loop gets stuck, doesn't poll further events, so you application no longer reacts to events and your UI freezes.
So you have to wonder what happens when you call
In practice, any code that takes a significant amount of time (>.1 second) should be delegated to a thread. That thread then communicates with the event loop thread by sending it events. Not a PyQt expert, but this looks like the answer.
PS: future-proofing: have you checked that you can use pygame and pyqt4 in the same application without getting conflicts?
So you have to wonder what happens when you call
clock.run()
.... In practice, any code that takes a significant amount of time (>.1 second) should be delegated to a thread. That thread then communicates with the event loop thread by sending it events. Not a PyQt expert, but this looks like the answer.
PS: future-proofing: have you checked that you can use pygame and pyqt4 in the same application without getting conflicts?
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net