aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/tutorials/cannon/t1.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/tutorials/cannon/t1.py')
-rw-r--r--examples/widgets/tutorials/cannon/t1.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/examples/widgets/tutorials/cannon/t1.py b/examples/widgets/tutorials/cannon/t1.py
index 43fea90c4..f3b4f9112 100644
--- a/examples/widgets/tutorials/cannon/t1.py
+++ b/examples/widgets/tutorials/cannon/t1.py
@@ -1,7 +1,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2021 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the Qt for Python examples of the Qt Toolkit.
@@ -43,14 +43,16 @@
import sys
-from PySide6 import QtWidgets
+from PySide6.QtWidgets import QApplication, QPushButton
-app = QtWidgets.QApplication(sys.argv)
-hello = QtWidgets.QPushButton("Hello world!")
-hello.resize(100, 30)
+if __name__ == '__main__':
+ app = QApplication(sys.argv)
-hello.show()
+ hello = QPushButton("Hello world!")
+ hello.resize(100, 30)
-sys.exit(app.exec_())
+ hello.show()
+
+ sys.exit(app.exec_())