python - PyQt application and infinite loop -


  डीईफ़ मुख्य (): ऐप = QtGui.QApplication (sys.argv) GUI = GUIClass () gui.showUI () App.exec_ () जबकि true: if win32api.GetAsyncKeyState (win32con.VK_SHIFT): प्रिंट (True) अगर __name__ == '__main__': मुख्य ()  

ऐप के बाद कोड Exec_ () चल नहीं रहा है अनगिनत लूप कैसे करें और मेरा पाय्युटी एप्लीकेशन चलाएं?

धन्यवाद।

pyqt अपने स्वयं के (अनन्त) ईवेंट लूप के साथ आता है ताकि आपको अपना खुद का निर्माण न करना पड़े। app.exec _ () इस पाश में प्रवेश करता है, यही कारण है कि आप निष्पादित करने के बाद कोड नहीं देखते हैं। QTimer के उपयोग का उदाहरण:

में मुख्य () से पहले exec_ ( ) :

  def timout (): यदि win32api.GetAsyncKeyState (win32con.VK_SHIFT): प्रिंट (True) टाइमर = QtCore.QTimer (स्वयं) timer.timeout.connect (टाइमआउट ) टाइमर.प्रारंभ (100)  

Comments

Popular posts from this blog

Docker - Tomcat and PostgreSQL containers in same host - No Route to host -

Python Equivalent for matlab cart2pol and pol2cart -

java - Joda Time Interval Not returning what I expect -