python - Window is closing immediately after I run program in PyQt 4 (anaconda) [PyCharm 4.5] -


so, trying run simple program (a window) in pycharm running anaconda 2.7 & pyqt4. whenever click run button opens program closes window fast me see it. may anyone, please help? thank you!

p.s.

i'm new programming.

{__author__ = 'jay'  import sys pyqt4 import qtgui  app = qtgui.qapplication(sys.argv)  window = qtgui.qwidget()  window.show()} 

you need block execution of program after call window.show() window object remains active otherwise garbage collected. app.exec_() you.

{__author__ = 'jay'  import sys pyqt4 import qtgui  app = qtgui.qapplication(sys.argv)  window = qtgui.qwidget()  window.show() app.exec_()}     # added line 

Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -