NVaughan
NVaughan

Reputation: 1665

PyQt4 in Mac OS X for Python 3 doesn't seem to work

I installed PyQT4 in Mac OS X El Capitan for Python 3 using the instructions given in this answer. The instructions gave the following commands:

brew install python3
brew install qt
brew install sip --with-python3
brew install pyqt --with-python3

which I run with no problems at all. I then added this line to my .bashrc file:

PYTHONPATH=/usr/local/lib/python3.3/site-packages:$PYTHONPATH

I verified Python 3 was running correcly. I also correctly evaluated the following code within Python 3:

import PyQT4

Now, when I try to run this simple program, nothing happens:

import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.show()

After running it, no window opens and nothing happens. I get no error or warning messages. Any ideas of what's going on in here?

Upvotes: 2

Views: 783

Answers (1)

This is correct. When you run your code, nothing is supposed to happen, and the application should immediately exit without any errors. Your example translated to C++ will behave identically, too.

Perhaps you wished to spin the event loop? app.exec() will do that.

Upvotes: 1

Related Questions