添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
# create our window # define window xLoc,yLoc,xDim,yDim self.setGeometry( 300, 200, 300, 350) self.setWindowTitle("Example") self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # create some Labels self.label1 = QtGui.QLabel("",self) self.label1.move(70,25) self.label2 = QtGui.QLabel("",self) self.label2.move(115,25) self.label3 = QtGui.QLabel("",self) self.label3.move(160,25) # text input field self.textInput1 = QtGui.QLineEdit(self) self.textInput1.setText("") self.textInput1.setFixedWidth(35) self.textInput1.move(55,40) self.textInput2 = QtGui.QLineEdit(self) self.textInput2.setText("") self.textInput2.setFixedWidth(35) self.textInput2.move(100,40) self.textInput3 = QtGui.QLineEdit(self) self.textInput3.setText("") self.textInput3.setFixedWidth(35) self.textInput3.move(145,40) # ok button okButton = QtGui.QPushButton("Ok", self) okButton.clicked.connect(self.onOk) okButton.move(170,320) # now make the window visible self.show() def onOk(self): self.result = userOk # Constant definitions userOk = "Ok" # code *********************************************************************************** form = Example() form.exec_() if form.result==userOk: # steps to handle user clicking Cancel How can i add a new icon in this window ??
Maybe you need a special feature, go into Macros_recipes and Code_snippets , Topological_data_scripting .
My macros on Gist.github here complete macros Wiki and forum .
Hi i have seen it but it didn't work, can you find the solution for this?

Code: Select all

from PySide import QtGui, QtCore
class Test(QtGui.QDialog):
	""""""
	def __init__(self):
		super(Test, self).__init__()
		self.initUI()
	def initUI(self):
		# create our window
		# define window	 xLoc,yLoc,xDim,yDim
		self.setGeometry(300, 200, 350, 100)
		self.setMinimumSize(350,400)
		self.setMaximumSize(350,100)		
		self.setWindowTitle("Library")
		self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
		#self.image_01 = "C:\Program Files\FreeCAD 0.17\IconeLIBFACOD\Icone.png" 
        	self.image_01 = path+"Icone.png" # adapter le nom de l'icne
        	Icone = QtGui.QIcon() 
        	Icone.addPixmap(QtGui.QPixmap(self.image_01),QtGui.QIcon.Normal, QtGui.QIcon.ON)
		Icone.move(270,39)
		self.show()
form = Test()
form.exec_()
here example we create a window with a QLabel() text + image

Code: Select all

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
#    ### 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()
#patience.close()
#MyLabelPatience().movie.start()
#MyLabelPatience().movie.stop()
							
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.