本文整理汇总了Python中PyQt4.QtGui.QPushButton方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QPushButton方法的具体用法?Python QtGui.QPushButton怎么用?Python QtGui.QPushButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QPushButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def initUI(self):
self.box = QtGui.QComboBox(self)
for i in self.formats:
self.box.addItem(strftime(i))
insert = QtGui.QPushButton("Insert",self)
insert.clicked.connect(self.insert)
cancel = QtGui.QPushButton("Cancel",self)
cancel.clicked.connect(self.close)
layout = QtGui.QGridLayout()
layout.addWidget(self.box,0,0,1,2)
layout.addWidget(insert,1,0)
layout.addWidget(cancel,1,1)
self.setGeometry(300,300,400,80)
self.setWindowTitle("Date and Time")
self.setLayout(layout)
示例2: initUI
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def initUI(self):
self.text_show2 = QtGui.QTextEdit()
self.text_show2.setText(SHOW2STR)
self.text_show2.setReadOnly(True)
self.text_hex = QtGui.QTextEdit()
self.text_hex.setText(HEXSTR)
self.text_hex.setReadOnly(True)
self.save_but = QtGui.QPushButton(u'保存为PDF', self)
self.save_but.setCheckable(False)
self.save_but.clicked.connect(self.save_pdf)
vbox = QtGui.QVBoxLayout()
vbox.addWidget(self.text_show2)
vbox.addWidget(self.text_hex)
vbox.addWidget(self.save_but)
self.setLayout(vbox)
"""
self.splitter = QtGui.QSplitter(self)
self.splitter.addWidget(self.text_show2)
self.splitter.addWidget(self.text_hex)
self.splitter.setOrientation(QtCore.Qt.Vertical)
"""
示例3: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def __init__(self, ecuscanner):
super(Ecu_finder, self).__init__()
self.ecuscanner = ecuscanner
layoutv = widgets.QVBoxLayout()
layouth = widgets.QHBoxLayout()
self.setLayout(layoutv)
layoutv.addLayout(layouth)
self.ecuaddr = widgets.QLineEdit()
self.ecuident = widgets.QLineEdit()
layouth.addWidget(widgets.QLabel("Addr :"))
layouth.addWidget(self.ecuaddr)
layouth.addWidget(widgets.QLabel("ID frame :"))
layouth.addWidget(self.ecuident)
button = widgets.QPushButton("VALIDATE")
layouth.addWidget(button)
button.clicked.connect(self.check)
示例4: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(400, 300)
self.verticalLayout = QtGui.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.textEdit = QtGui.QTextEdit(Dialog)
self.textEdit.setReadOnly(True)
self.textEdit.setObjectName(_fromUtf8("textEdit"))
self.verticalLayout.addWidget(self.textEdit)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.ExitButton = QtGui.QPushButton(Dialog)
self.ExitButton.setObjectName(_fromUtf8("ExitButton"))
self.horizontalLayout.addWidget(self.ExitButton)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.verticalLayout.addLayout(self.horizontalLayout)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例5: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def setupUi(self, MemoEdit):
'''被memoedit调用'''
MemoEdit.setFixedWidth(400)
'''初始化组件'''
self.titleEdit = QtGui.QLineEdit()
self.timeEdit = QtGui.QDateTimeEdit()
self.contentEdit = QtGui.QTextEdit()
self.okBtn = QtGui.QPushButton(_fromUtf8("确定"))
self.layout = QtGui.QVBoxLayout()
'''设置组件大小属性'''
self.layout.setMargin(0)
self.layout.setSpacing(0)
''' 设置stylesheet'''
'''设置布局'''
self.layout.addWidget(self.titleEdit)
self.layout.addWidget(self.timeEdit)
self.layout.addWidget(self.contentEdit)
self.layout.addWidget(self.okBtn)
self.setLayout(self.layout)
示例6: initUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def initUi(self):
""""""
self.setWindowTitle(u'测试')
buttonAccount = QtGui.QPushButton(u'查询账户')
buttonInvestor = QtGui.QPushButton(u'查询投资者')
buttonPosition = QtGui.QPushButton(u'查询持仓')
buttonAccount.clicked.connect(self.__mainEngine.getAccount)
buttonInvestor.clicked.connect(self.__mainEngine.getInvestor)
buttonPosition.clicked.connect(self.__mainEngine.getPosition)
hBox = QtGui.QHBoxLayout()
hBox.addWidget(buttonAccount)
hBox.addWidget(buttonInvestor)
hBox.addWidget(buttonPosition)
self.setLayout(hBox)
########################################################################
示例7: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def __init__(self, *args, **kwargs):
super(Calculator, self).__init__(*args, **kwargs)
# Single-inheritence approach: http://goo.gl/WNiHc
# Calculator class only inherits from QWidget
# A specific member attribute self.ui contains all
# widgets set up in the designer.
self.ui = Ui_Calculator()
self.ui.setupUi(self)
self.ui.calcButton = QtGui.QPushButton("Calculate")
self.ui.horizontalLayout_2.addWidget(self.ui.calcButton)
# Create a validator for each QLineEdit that only
# allows a user to enter floats: 123.123
self.ui.inputA.setValidator(QtGui.QDoubleValidator())
self.ui.inputB.setValidator(QtGui.QDoubleValidator())
# instead of using the stock operator values set in the
# ui file, lets set the box to match our class attribute
self.ui.operatorBox.clear()
self.ui.operatorBox.addItems(self.OPS.keys())
self.ui.clearButton.clicked.connect(self.clear)
self.ui.calcButton.clicked.connect(self.calc)
示例8: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def __init__(self, text='', imagePath='', size=None, parent=None):
super(AssetItem, self).__init__(parent=parent)
self.layout = QtGui.QVBoxLayout(self)
self.button = QtGui.QPushButton()
self.text = QtGui.QLabel()
self.layout.addWidget(self.button)
self.layout.addWidget(self.text)
if text:
self.setText(text)
if imagePath:
self.setImage(imagePath)
if size:
self.setSize(size)
else:
set.setSize(64, 64)
示例9: showMessage
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def showMessage(self, data):
"""Show message to user"""
# pylint: disable-msg=E1101
url = '{}/viz/{}/public_map'.format(self.currentUserData['base_url'], self.currentViz['id'])
def openVis():
"""Open map in default browser"""
webbrowser.open(url)
def copyURL():
"""Copy map URL to clipboard"""
QApplication.clipboard().setText(url)
if not self.withWarnings:
self.ui.bar.clearWidgets()
msg = '{} created'
else:
msg = '{} created, but has warnings'
widget = self.ui.bar.createMessage(QApplication.translate('CartoDBPlugin', 'Map Created'),
QApplication.translate('CartoDBPlugin', msg).format(self.currentViz['name']))
button = QPushButton(widget)
button.setText(QApplication.translate('CartoDBPlugin', 'Copy Link'))
button.pressed.connect(copyURL)
widget.layout().addWidget(button)
button = QPushButton(widget)
button.setText(QApplication.translate('CartoDBPlugin', 'Open'))
button.pressed.connect(openVis)
widget.layout().addWidget(button)
self.ui.bar.pushWidget(widget, QgsMessageBar.INFO if not self.withWarnings else QgsMessageBar.WARNING, duration=10)
示例10: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def setupUi(self, ImgurClientIdDialog):
ImgurClientIdDialog.setObjectName(_fromUtf8("ImgurClientIdDialog"))
ImgurClientIdDialog.resize(754, 467)
self.gridLayout_2 = QtGui.QGridLayout(ImgurClientIdDialog)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.enterClientIdBtn = QtGui.QPushButton(ImgurClientIdDialog)
self.enterClientIdBtn.setObjectName(_fromUtf8("enterClientIdBtn"))
self.gridLayout_2.addWidget(self.enterClientIdBtn, 3, 0, 1, 1)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.label_2 = QtGui.QLabel(ImgurClientIdDialog)
self.label_2.setTextFormat(QtCore.Qt.RichText)
self.label_2.setOpenExternalLinks(True)
self.label_2.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.horizontalLayout_2.addWidget(self.label_2)
self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.label = QtGui.QLabel(ImgurClientIdDialog)
self.label.setObjectName(_fromUtf8("label"))
self.horizontalLayout.addWidget(self.label)
self.clientIdLineEdit = QtGui.QLineEdit(ImgurClientIdDialog)
self.clientIdLineEdit.setObjectName(_fromUtf8("clientIdLineEdit"))
self.horizontalLayout.addWidget(self.clientIdLineEdit)
self.gridLayout_2.addLayout(self.horizontalLayout, 2, 0, 1, 2)
self.enterLaterBtn = QtGui.QPushButton(ImgurClientIdDialog)
self.enterLaterBtn.setObjectName(_fromUtf8("enterLaterBtn"))
self.gridLayout_2.addWidget(self.enterLaterBtn, 3, 1, 1, 1)
self.retranslateUi(ImgurClientIdDialog)
QtCore.QMetaObject.connectSlotsByName(ImgurClientIdDialog)
示例11: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(820, 650)
MainWindow.setAutoFillBackground(False)
MainWindow.setDocumentMode(False)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setContentsMargins(-1, -1, 0, 0)
self.horizontalLayout.setSpacing(10)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.btnAdd = QtGui.QPushButton(self.centralwidget)
self.btnAdd.setObjectName(_fromUtf8("btnAdd"))
self.horizontalLayout.addWidget(self.btnAdd)
self.chkMore = QtGui.QCheckBox(self.centralwidget)
self.chkMore.setObjectName(_fromUtf8("chkMore"))
self.horizontalLayout.addWidget(self.chkMore)
self.verticalLayout.addLayout(self.horizontalLayout)
self.matplotlibwidget = MatplotlibWidget(self.centralwidget)
self.matplotlibwidget.setObjectName(_fromUtf8("matplotlibwidget"))
self.verticalLayout.addWidget(self.matplotlibwidget)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
示例12: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(820, 650)
MainWindow.setAutoFillBackground(False)
MainWindow.setDocumentMode(False)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setContentsMargins(-1, -1, 0, 0)
self.horizontalLayout.setSpacing(10)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.btnAdd = QtGui.QPushButton(self.centralwidget)
self.btnAdd.setObjectName(_fromUtf8("btnAdd"))
self.horizontalLayout.addWidget(self.btnAdd)
self.chkMore = QtGui.QCheckBox(self.centralwidget)
self.chkMore.setObjectName(_fromUtf8("chkMore"))
self.horizontalLayout.addWidget(self.chkMore)
self.verticalLayout.addLayout(self.horizontalLayout)
self.grPlot = PlotWidget(self.centralwidget)
self.grPlot.setObjectName(_fromUtf8("grPlot"))
self.verticalLayout.addWidget(self.grPlot)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
示例13: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(241, 367)
self.gridLayout = QtGui.QGridLayout(Form)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.label = QtGui.QLabel(Form)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
self.itemTree = QtGui.QTreeWidget(Form)
self.itemTree.setObjectName(_fromUtf8("itemTree"))
self.itemTree.headerItem().setText(0, _fromUtf8("1"))
self.itemTree.header().setVisible(False)
self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
self.label_2 = QtGui.QLabel(Form)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
self.formatList = QtGui.QListWidget(Form)
self.formatList.setObjectName(_fromUtf8("formatList"))
self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
self.exportBtn = QtGui.QPushButton(Form)
self.exportBtn.setObjectName(_fromUtf8("exportBtn"))
self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
self.closeBtn = QtGui.QPushButton(Form)
self.closeBtn.setObjectName(_fromUtf8("closeBtn"))
self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
self.paramTree = ParameterTree(Form)
self.paramTree.setObjectName(_fromUtf8("paramTree"))
self.paramTree.headerItem().setText(0, _fromUtf8("1"))
self.paramTree.header().setVisible(False)
self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
self.label_3 = QtGui.QLabel(Form)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
self.copyBtn = QtGui.QPushButton(Form)
self.copyBtn.setObjectName(_fromUtf8("copyBtn"))
self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
示例14: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(224, 117)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
Form.setSizePolicy(sizePolicy)
self.verticalLayout = QtGui.QVBoxLayout(Form)
self.verticalLayout.setMargin(0)
self.verticalLayout.setSpacing(1)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.translateLabel = QtGui.QLabel(Form)
self.translateLabel.setObjectName(_fromUtf8("translateLabel"))
self.verticalLayout.addWidget(self.translateLabel)
self.rotateLabel = QtGui.QLabel(Form)
self.rotateLabel.setObjectName(_fromUtf8("rotateLabel"))
self.verticalLayout.addWidget(self.rotateLabel)
self.scaleLabel = QtGui.QLabel(Form)
self.scaleLabel.setObjectName(_fromUtf8("scaleLabel"))
self.verticalLayout.addWidget(self.scaleLabel)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.mirrorImageBtn = QtGui.QPushButton(Form)
self.mirrorImageBtn.setToolTip(_fromUtf8(""))
self.mirrorImageBtn.setObjectName(_fromUtf8("mirrorImageBtn"))
self.horizontalLayout.addWidget(self.mirrorImageBtn)
self.reflectImageBtn = QtGui.QPushButton(Form)
self.reflectImageBtn.setObjectName(_fromUtf8("reflectImageBtn"))
self.horizontalLayout.addWidget(self.reflectImageBtn)
self.verticalLayout.addLayout(self.horizontalLayout)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
示例15: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPushButton [as 别名]
def __init__(self, certificates_instance, event_id):
"""
Setup widgets and select data from database.
"""
super(AddClientDialog, self).__init__()
# Window config
self.setWindowTitle(u"Adicionar cliente")
self.certificates_instance = certificates_instance
self.event_id = event_id
# Select clients in alphabetical order
cursor.execute("SELECT * FROM clients ORDER BY name ASC")
self.clients = cursor.fetchall()
# Define layouts
self.mainLayout = QtGui.QVBoxLayout()
# Frame config
self.titleLabel = QtGui.QLabel(u"Selecione um cliente")
self.titleLabel.setFont(titleFont)
# Fill combo with clients info
self.clientsList = QtGui.QComboBox()
for client in self.clients:
self.clientsList.addItem(unicode(client[1]))
# Create the main button
self.saveBtn = QtGui.QPushButton(u"Selecionar")
self.saveBtn.clicked.connect(self.add_client)
# Add all widgets to the mainLayout
self.mainLayout.addWidget(self.titleLabel)
self.mainLayout.addWidget(self.clientsList)
self.mainLayout.addWidget(self.saveBtn)
# Set mainLayout as the visible layout
self.setLayout(self.mainLayout)