diff options
author | Boris Verkhovskiy <boris.verk@gmail.com> | 2024-04-03 04:31:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 04:31:13 -0700 |
commit | fbf132752b743d0f43c3395da0699bee53da22df (patch) | |
tree | 56da43c86e1aebd24e3913b405e21d6f2812e9a3 /pyqt.html.markdown | |
parent | 247dc6e86c1421fa031e4b61c42c05ca6e09bfb0 (diff) | |
parent | c166f2acb295627c5ae305a6dd517a27ca8fece6 (diff) |
Merge branch 'master' into patch-1
Diffstat (limited to 'pyqt.html.markdown')
-rw-r--r-- | pyqt.html.markdown | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pyqt.html.markdown b/pyqt.html.markdown index 6bdb6488..2b331874 100644 --- a/pyqt.html.markdown +++ b/pyqt.html.markdown @@ -11,25 +11,25 @@ contributors: This is an adaption on the C++ intro to QT by [Aleksey Kholovchuk](https://github.com/vortexxx192 ), some of the code examples should result in the same functionality -this version just having been done using pyqt! +this version just having been done using pyqt! ```python import sys from PyQt4 import QtGui - + def window(): - # Create an application object + # Create an application object app = QtGui.QApplication(sys.argv) # Create a widget where our label will be placed in w = QtGui.QWidget() - # Add a label to the widget + # Add a label to the widget b = QtGui.QLabel(w) - # Set some text for the label + # Set some text for the label b.setText("Hello World!") - # Give some size and placement information + # Give some size and placement information w.setGeometry(100, 100, 200, 50) b.move(50, 20) - # Give our window a nice title + # Give our window a nice title w.setWindowTitle("PyQt") # Have everything display w.show() @@ -41,10 +41,10 @@ if __name__ == '__main__': ``` -In order to get some of the more advanced features in **pyqt** we need to start looking at building additional elements. +In order to get some of the more advanced features in **pyqt** we need to start looking at building additional elements. Here we show how to introduce a dialog popup box, useful for asking the user to confirm a decision or to provide information. -```Python +```python import sys from PyQt4.QtGui import * from PyQt4.QtCore import * @@ -63,7 +63,7 @@ def window(): w.setWindowTitle("PyQt Dialog") w.show() sys.exit(app.exec_()) - + # This function should create a dialog window with a button # that waits to be clicked and then exits the program def showdialog(): |