show() is not working in the console

已回答

I am using pycharm as the IDE for python development and I have noticed an annoying problem with the integrated python console. I use PyQt as the backbone for some GUI programming and when I make a window it does not show on the screen although I use the show() function. Here is an example code:

import sys
from PyQt4 import QtGui
from threading import Thread

app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
w.setGeometry(100, 100, 200, 50)
w.show()

Of course, if I run the same code in native python environment the window shows up right after the show() command.

Is this a general problem with Pycharm console or the way it initiates the python console? and can someone please recommend a solution?

Here are some details about my os and IDE: OS : Debian jessie Python: Python 3.4 PyQt: PyQt4 Pycharm 2017.1.4

0
Avatar
Permanently deleted user

I have the same issue, found a workaround for the pydev console, this is copied from the matplotlib hook for the dev console:

 

from pydev_ipython.inputhook import enable_gui
enable_gui('qt4') # or qt5 if using PyQt5
1

Hi,

Could you please report it to https://youtrack.jetbrains.com/issues/PY and attach your idea.log (Help | Show Log in...)?

0

请先登录再写评论。