Last active
January 27, 2019 20:43
-
-
Save cgoldberg/8564769 to your computer and use it in GitHub Desktop.
Hello World, in Python3 and Qt5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
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
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. 🙂