27 May

“Qtutils” is a useful pack

I come up with an problem: http://stackoverflow.com/questions/30180046/statusbar-doesnt-show-message-immediately-and-sometimes-crash

I created an interface in pyqt4 designer, there is only a button and a status bar. I want to show a message in the status bar when I click the button. For some reason I have to put this action in a new thread.

But when I click the button, nothing happened. The message didn’t appear until I drag the edge of the window. Sometimes the click action even cause the program to crash

as three_pineapples answered :”The crash happens because you are interacting with the Qt GUI from a secondary thread. You are only allowed to interact with the GUI from the main thread”.

He provided a very useful pack “qtutils”.

I define my interaction action as a new fuction, say shili(self). When I want to interact with GUI from a secondary thread, I simply write :

inmain(self.shili)

Leave a Reply