Dialog creation image and animated GIF/fr: Difference between revisions
(Created page with "Création d'une boîte de dialogue pour image et GIF animé") |
(Created page with "Exemple de création de boîte de dialogue avec PySide.") |
||
Line 3: | Line 3: | ||
== Introduction == |
== Introduction == |
||
Exemple de [[Dialog_creation/fr|création de boîte de dialogue]] avec [[PySide/fr|PySide]]. |
|||
In this example, the entire interface is defined in [[Python|Python]]. Although this is possible for small interfaces, for larger interfaces the recommendation is to create {{FileName|.ui}} files through Qt Designer, and load these in the program. See [[Interface_creation_with_UI_files|Interface creation with UI files]]. |
In this example, the entire interface is defined in [[Python|Python]]. Although this is possible for small interfaces, for larger interfaces the recommendation is to create {{FileName|.ui}} files through Qt Designer, and load these in the program. See [[Interface_creation_with_UI_files|Interface creation with UI files]]. |
Revision as of 14:58, 4 July 2020
Introduction
Exemple de création de boîte de dialogue avec 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 .ui files through Qt Designer, and load these in the program. See Interface creation with UI files.
Dialog with image (QLabel) and animated GIF (QMovie)
import PySide
from PySide import QtGui ,QtCore
from PySide.QtGui import QPixmap, QMovie, QLabel
from PySide.QtCore import *
class MyLabelPatience():
label = QtGui.QLabel()
label.setText("<img src=" + path_Name_Image + "><b><center>Wait please</center> \n\n<center>i search the fonts !\n\n</center></b>")
# center screen
ecran = FreeCADGui.getMainWindow().frameGeometry()
xF = 250; yF = 120
xW = (ecran.width()/2) - (xF/2)
yW = (ecran.height()/2)- (yF/2)
label.setGeometry(xW, yW, xF, yF)
####
label.setStyleSheet("QLabel {background-color : #F0C300;font: 12pt; }");
label.setWindowFlags(Qt.WindowFlags(Qt.FramelessWindowHint)) # pas de bords (not border)
### un-comment for use ###############
movie = QtGui.QMovie(path_Name_Image) # anime le fichier Gif anime (decommenter)
label.setMovie(movie)
movie.start()
##################
patience = MyLabelPatience().label
patience.show() #show the image
#patience.close() #close the Qlabel
#MyLabelPatience().movie.start() #start the animation (after patience.show())
#MyLabelPatience().movie.stop() #stop animation
Example QLabel with image and text.
Example QLabel with animated GIF.
Hub utilisateurs expérimentés
- Scripts FreeCAD : Python, Introduction à Python, Tutoriel sur les scripts Python, Débuter avec les scripts
- Modules : Modules intégrés, Unités, Quantity
- Ateliers : Création d'atelier, Commands Gui, Les commandes, Installer des ateliers supplémentaires
- Maillages et objets Parts : Scripts Mesh, Script de données topologiques, Conversion objet Mesh en Part, PythonOCC
- Objets paramétriques : Objets créés par script, Viewproviders (Icône personnalisée dans l'arborescence)
- Scénographie : Graphe de scène Coin (Inventor), Pivy
- Interface graphique : Création d'interface, Création d'une boite de dialogue (1, 2, 3, 4, 5), PySide, Exemples PySide débutant, intermédiaire, expérimenté
- Macros : Macros, Comment installer des macros
- Intégration : Intégrer FreeCAD, Intégration de FreeCADGui
- Autre : Expressions, Extraits de codes, Fonction - tracer une ligne, Bibliothèque mathématique vectorielle de FreeCAD (déprécié)