Python Forum
Newbie prob - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Newbie prob (/thread-15747.html)



Newbie prob - Snakecharmer - Jan-29-2019

Hi,
I just installed PyQt4 on a Raspi and I'm totally new to both Python and Qt. I'm trying to do a Hello World - just an empty window should pop up. But instead it seems as if nothing happens.

Here is a screenshot:
[Image: bild-7f89ac-1548793246.png.html]

Any idea?


RE: Newbie prob - ichabod801 - Jan-29-2019

Please do not post screen shots. Instead post your code, using python tags. Here are instructions.


RE: Newbie prob - Snakecharmer - Jan-29-2019

I posted the screenshot because the left window did a restart and I have no idea what was going on...

import sys
from PyQt4 import QtGui

app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()

window.show()



RE: Newbie prob - Snakecharmer - Jan-29-2019

Solved it. The example was for Windows, not for Linux. It needed an additional command at the end of the code:
sys.exit(app.exec_())
Youngplayer's trap, so to speak...