diff options
Diffstat (limited to 'sources/pyside2/doc/tutorials/basictutorial/widgets.rst')
-rw-r--r-- | sources/pyside2/doc/tutorials/basictutorial/widgets.rst | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sources/pyside2/doc/tutorials/basictutorial/widgets.rst b/sources/pyside2/doc/tutorials/basictutorial/widgets.rst index c864e3d47..41e474227 100644 --- a/sources/pyside2/doc/tutorials/basictutorial/widgets.rst +++ b/sources/pyside2/doc/tutorials/basictutorial/widgets.rst @@ -5,7 +5,9 @@ As with any other programming framework, you start with the traditional "Hello World" program. Here is a simple example of a Hello World application in PySide2: -:: + +.. code-block:: python + import sys from PySide2.QtWidgets import QApplication, QLabel @@ -22,13 +24,17 @@ After the imports, you create a `QApplication` instance. As Qt can receive arguments from command line, you may pass any argument to the QApplication object. Usually, you don't need to pass any arguments so you can leave it as is, or use the following approach: -:: + +.. code-block:: python + app = QApplication([]) After the creation of the application object, we have created a `QLabel` object. A `QLabel` is a widget that can present text (simple or rich, like html), and images: -:: + +.. code-block:: python + # This HTML approach will be valid too! label = QLabel("<font color=red size=40>Hello World!</font>") |