aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/tutorials/cannon/t1.py
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2021-04-21 15:15:52 +0200
committerFriedemann Kleint <[email protected]>2021-04-22 08:36:25 +0200
commitdeaecf79f3a66ac9aba0d844c8a81efd056f080f (patch)
treee19fb6aeba9d2c4fa36ebadd35191d700c0226b9 /examples/widgets/tutorials/cannon/t1.py
parentff6f76521b2a401fbd648964a70ed3843cb7979a (diff)
Cannon tutorial: Brush up code
- Use per class imports - Remove string-based connections, fixing some errors introduced by the snake case renaming - Add some spacing and indent main - Use math.pi Task-number: PYSIDE-1112 Change-Id: I2171fc9eb27f9926f32648a289df404d390ace43 Reviewed-by: Christian Tismer <[email protected]>
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_())