Code: Select all
from PySide import QtGui, QtCore
class Example(QtGui.QDialog):
""""""
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
# 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:
pass
# steps to handle user clicking Cancel