Skip to content

Instantly share code, notes, and snippets.

@cgoldberg
Last active January 27, 2019 20:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgoldberg/8564769 to your computer and use it in GitHub Desktop.
Save cgoldberg/8564769 to your computer and use it in GitHub Desktop.
Hello World, in Python3 and Qt5
#!/usr/bin/env python3
"""
helloworld.py
Python3 and Qt5
"""
from PyQt5 import QtWidgets
def main():
app = QtWidgets.QApplication([])
window = QtWidgets.QMainWindow()
label = QtWidgets.QLabel('\tHello World!')
window.setCentralWidget(label)
window.show()
app.exec_()
if __name__ == '__main__':
main()
@DDR0
Copy link

DDR0 commented May 5, 2018

Just a side-note here, but this was very helpful for figuring out if I'd actually managed to build PyQt5 correctly. (It turns out I'd missed a build requirement for having graphics.)

Thank you, cgoldberg. 🙂

@spezold
Copy link

spezold commented Jun 13, 2018

Thanks a lot! Also just a side note: in Python 3, exec is not a keyword any more, so with Python 3 and PyQt 5, you may now also write app.exec() rather than app.exec_()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment