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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -