Dialog creation with various widgets/it

Introduzione
Questo è un esempio di creazione di dialoghi con PySide.

In questo esempio, l'intera interfaccia è definita in Python. Sebbene ciò sia possibile per interfacce di piccole dimensioni, per le interfacce più grandi si raccomanda di creare i file tramite Qt Designer e caricarli nel programma. Vedere Creazione di una interfaccia con dei file UI.

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