Skip to content

Instantly share code, notes, and snippets.

@cgoldberg
Last active January 27, 2019 20:43
Show Gist options
  • 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()
@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