python - Wait for a trigger -


i'm writing pyqt application needs input before loading main window. have set following class (minimized):

class myinput(qwidget):     def __init__(self):         super(myinput, self).__init__()         self.thing = false          mybutton = qpushbutton('press me', self)         mybutton.clicked.connect(self.set_data)      def set_data(self):         self.hide()         self.destroylater()         self.thing = true      def get_thing(self):         self.show()         return self.thing 

later, have function:

def ask_thing():     mi = myinput()     return mi.get_thing() 

now, when call ask_thing(), want mi.get_thing() wait button pressed before returning value (or return false if closed). however, self.show() seems run separately , lets code continue executing, hitting return statement , leaving function.

how can wait input?

maybe have consider changing qwidget qdialog. change function show exec_, execute widget waiting user's interaction.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

excel vba - VBA Proxy auto-configuration for http requests -

php - phpWord - Tables with borders in headers/footers -