Dialog creation with various widgets/it

Introduzione
This is an example of dialog creation with PySide.

In this example, the entire interface is defined in Python. Although this is possible for small interfaces, for larger interfaces the recommendation is to create files through Qt Designer, and load these in the program. See Interface creation with UI files.

Method 1
An example of a dialog box complete with its connections.

Here the same window but with an icon on each button.

Download associated icons (click right "Copy the image below ...)"



Here the code to display the icon on the pushButton, change the name for another button, (radioButton, checkBox) and the path to the icon.

The command UserAppData gives the user path AppHomePath gives the installation path of FreeCAD

This command reverses the horizontal button, right to left.

Method 2
Another method to display a window, here by creating a file QtForm.py which contains the header program (module called with import QtForm), and a second module that contains the code window all these accessories, and your code (the calling module).

This method requires two separate files, but allows to shorten your program using the file ' ' QtForm.py ' ' import. Then distribute the two files together, they are inseparable.

The file QtForm.py

The calling file that contains the window and your code.

The file my_file.py

The connections are to do, a good exercise.

Other example

Are treated :

The code page and the icons Qt_Example
 * 1) icon for window
 * 2) horizontalSlider
 * 3) progressBar horizontal
 * 4) verticalSlider
 * 5) progressBar vertical
 * 6) lineEdit
 * 7) lineEdit
 * 8) doubleSpinBox
 * 9) doubleSpinBox
 * 10) doubleSpinBox
 * 11) button
 * 12) button
 * 13) radioButton with icons
 * 14) checkBox with icon checked and unchecked
 * 15) textEdit
 * 16) graphicsView with 2 graphes