Dialog creation image and animated GIF/pl: Difference between revisions

From FreeCAD Documentation
(Created page with "==Wprowadzenie==")
(Created page with "{{Caption|Przykład QLabel z animowanym GIF-em.}}")
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
==Wprowadzenie==
==Wprowadzenie==


This is an example of [[Dialog_creation|dialog creation]] with [[PySide|PySide]].
To jest przykład [[Dialog_creation/pl|tworzenia dialogu]] z [[PySide/pl|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.
W tym przykładzie cały interfejs jest zdefiniowany w środowisku [[Python/pl|Python]]. Chociaż jest to możliwe w przypadku małych interfejsów, w przypadku większych interfejsów zaleca się tworzenie plików {{FileName|.ui}} za pomocą Qt Designer i ładowanie ich do programu.


==Dialog with image (QLabel) and animated GIF (QMovie) ==
<span id="Dialog_with_image_(QLabel)_and_animated_GIF_(QMovie)"></span>
==Okno dialogowe z obrazkiem ''(QLabel)'' i animowanym GIF-em ''(QMovie)''==


{{Code|code=
{{Code|code=
Line 42: Line 43:


[[File:Qlabel Image00.png]]
[[File:Qlabel Image00.png]]
{{Caption|Example QLabel with image and text.}}
{{Caption|Przykład QLabel z obrazem i tekstem.}}


[[File:Qlabel Image Animee00.gif]]
[[File:Qlabel Image Animee00.gif]]
{{Caption|Example QLabel with animated GIF.}}
{{Caption|Przykład QLabel z animowanym GIF-em.}}


{{Powerdocnavi{{#translation:}}}}
{{Powerdocnavi{{#translation:}}}}

Latest revision as of 19:59, 11 November 2023

Other languages:

Wprowadzenie

To jest przykład tworzenia dialogu z PySide.

W tym przykładzie cały interfejs jest zdefiniowany w środowisku Python. Chociaż jest to możliwe w przypadku małych interfejsów, w przypadku większych interfejsów zaleca się tworzenie plików .ui za pomocą Qt Designer i ładowanie ich do programu.

Okno dialogowe z obrazkiem (QLabel) i animowanym GIF-em (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

Przykład QLabel z obrazem i tekstem.

Przykład QLabel z animowanym GIF-em.