python qt 按钮_Python QtWidgets.QPushButton方法代码示例

本文整理汇总了Python中PySide2.QtWidgets.QPushButton方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QPushButton方法的具体用法?Python QtWidgets.QPushButton怎么用?Python QtWidgets.QPushButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块PySide2.QtWidgets的用法示例。

在下文中一共展示了QtWidgets.QPushButton方法的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

​点赞 6

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self, parent=None):

super(BrowseEdit, self).__init__(parent)

self.text = QtWidgets.QLineEdit()

self.text.returnPressed.connect(self.apply)

self.button = QtWidgets.QPushButton('B')

self.button.setFixedSize(21, 21)

self.button.released.connect(self.browse)

self.layout = QtWidgets.QHBoxLayout(self)

self.layout.setContentsMargins(0, 0, 0, 0)

self.layout.setSpacing(0)

self.layout.addWidget(self.text)

self.layout.addWidget(self.button)

self._value = self.value()

开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:18,

示例2: __init__

​点赞 6

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self, command, parent=None):

super(CommandDisplayDialog, self).__init__(parent)

self.setWindowTitle("Command")

self.text = QtWidgets.QTextEdit()

self.text.setReadOnly(True)

self.text.setPlainText(command)

self.ok = QtWidgets.QPushButton('ok')

self.ok.released.connect(self.accept)

self.button_layout = QtWidgets.QHBoxLayout()

self.button_layout.setContentsMargins(0, 0, 0, 0)

self.button_layout.addStretch(1)

self.button_layout.addWidget(self.ok)

self.layout = QtWidgets.QVBoxLayout(self)

self.layout.addWidget(self.text)

self.layout.addLayout(self.button_layout)

开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:19,

示例3: __init__

​点赞 6

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self):

super(ButtonAndLongProcess, self).__init__()

self.button = QPushButton("button")

self.button.clicked.connect(self.buttonClicked)

self.label = QLabel("label: before clicked")

layout = QVBoxLayout()

layout.addWidget(self.button)

layout.addWidget(self.label)

self.setLayout(layout)

self.long_process_thread = LongProcessThread()

self.long_process_thread.transaction.connect(self.afterLongProcess)

开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:18,

示例4: __init__

​点赞 6

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self):

super(ButtonWithSizePolicy, self).__init__()

button1 = QPushButton("button default")

button2 = QPushButton("button maximum")

button2.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)

button3 = QPushButton("button preferred")

button3.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)

button4 = QPushButton("button expanding")

button4.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

button5 = QPushButton("button minimum")

button5.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

button6 = QPushButton("button minimum expanding")

button6.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)

layout = QVBoxLayout()

layout.addWidget(button1)

layout.addWidget(button2)

layout.addWidget(button3)

layout.addWidget(button4)

layout.addWidget(button5)

layout.addWidget(button6)

self.setLayout(layout)

开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:26,

示例5: createTweetsGroupBox

​点赞 6

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def createTweetsGroupBox(self):

self.tweets_group_box = QtWidgets.QGroupBox("Tweets")

self.account_address = QtWidgets.QLineEdit()

self.fetch_button = QtWidgets.QPushButton("Fetch")

self.add_to_bookmark_button = QtWidgets.QPushButton("Bookmark it!")

self.connect(self.fetch_button, QtCore.SIGNAL('clicked()'), self.fetchTweets)

self.connect(self.add_to_bookmark_button, QtCore.SIGNAL('clicked()'), self.bookmarkAddress)

account_address_layout = QtWidgets.QHBoxLayout()

account_address_layout.addWidget(self.account_address)

account_address_layout.addWidget(self.fetch_button)

account_address_layout.addWidget(self.add_to_bookmark_button)

self.tweets_layout = QtWidgets.QVBoxLayout()

self.tweets_main_layout = QtWidgets.QVBoxLayout()

self.tweets_main_layout.addWidget(QtWidgets.QLabel("Address:"))

self.tweets_main_layout.addLayout(account_address_layout)

self.tweets_main_layout.addSpacing(20)

self.tweets_main_layout.addLayout(self.tweets_layout)

self.tweets_group_box.setLayout(self.tweets_main_layout)

开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:24,

示例6: setupUi

​点赞 6

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def setupUi(self, Form):

Form.setObjectName("Form")

Form.resize(300, 150)

self.verticalLayout = QtWidgets.QVBoxLayout(Form)

self.verticalLayout.setObjectName("verticalLayout")

self.btnCreateSphere = QtWidgets.QPushButton(Form)

self.btnCreateSphere.setObjectName("btnCreateSphere")

self.verticalLayout.addWidget(self.btnCreateSphere)

self.btnCallCppPlugin = QtWidgets.QPushButton(Form)

self.btnCallCppPlugin.setObjectName("btnCallCppPlugin")

self.verticalLayout.addWidget(self.btnCallCppPlugin)

self.btnCallCSPlugin = QtWidgets.QPushButton(Form)

self.btnCallCSPlugin.setObjectName("btnCallCSPlugin")

self.verticalLayout.addWidget(self.btnCallCSPlugin)

self.retranslateUi(Form)

QtCore.QMetaObject.connectSlotsByName(Form)

开发者ID:WendyAndAndy,项目名称:MayaDev,代码行数:19,

示例7: setLang

​点赞 6

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def setLang(self, langName):

uiList_lang_read = self.memoData['lang'][langName]

for ui_name in uiList_lang_read:

ui_element = self.uiList[ui_name]

if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:

# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox

if uiList_lang_read[ui_name] != "":

ui_element.setText(uiList_lang_read[ui_name])

elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:

# uiType: QMenu, QGroupBox

if uiList_lang_read[ui_name] != "":

ui_element.setTitle(uiList_lang_read[ui_name])

elif type(ui_element) in [ QtWidgets.QTabWidget]:

# uiType: QTabWidget

tabCnt = ui_element.count()

if uiList_lang_read[ui_name] != "":

tabNameList = uiList_lang_read[ui_name].split(';')

if len(tabNameList) == tabCnt:

for i in range(tabCnt):

if tabNameList[i] != "":

ui_element.setTabText(i,tabNameList[i])

elif type(ui_element) == str:

# uiType: string for msg

if uiList_lang_read[ui_name] != "":

self.uiList[ui_name] = uiList_lang_read[ui_name]

开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:27,

示例8: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self, hexacolor, parent=None):

super(ColorDialog, self).__init__(parent)

self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

self.setAttribute(QtCore.Qt.WA_TranslucentBackground)

self.colorwheel = ColorWheel()

self.colorwheel.set_current_color(QtGui.QColor(hexacolor))

self.ok = QtWidgets.QPushButton('ok')

self.ok.released.connect(self.accept)

self.layout = QtWidgets.QVBoxLayout(self)

self.layout.setContentsMargins(0, 0, 0, 0)

self.layout.setSpacing(0)

self.layout.addWidget(self.colorwheel)

self.layout.addWidget(self.ok)

开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:16,

示例9: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self):

super(ButtonAndLabel, self).__init__()

self.button = QPushButton("button")

self.button.clicked.connect(self.buttonClicked)

self.label = QLabel("label: before clicked")

layout = QVBoxLayout()

layout.addWidget(self.button)

layout.addWidget(self.label)

self.setLayout(layout)

开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:15,

示例10: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self):

super(ButtonAndDialog, self).__init__()

self.button = QPushButton("button")

self.button.clicked.connect(self.buttonClicked)

self.label = QLabel("")

layout = QVBoxLayout()

layout.addWidget(self.button)

layout.addWidget(self.label)

self.setLayout(layout)

开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:15,

示例11: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self):

super(ButtonAndList, self).__init__()

self.button = QPushButton("button")

self.button.clicked.connect(self.buttonClicked)

self.v_layout = QVBoxLayout()

layout = QVBoxLayout()

layout.addWidget(self.button)

layout.addLayout(self.v_layout)

self.setLayout(layout)

开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:15,

示例12: setupUi

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def setupUi(self, Form):

Form.setObjectName("Form")

Form.resize(360, 180)

self.gridLayout = QtWidgets.QGridLayout(Form)

self.gridLayout.setObjectName("gridLayout")

self.label_2 = QtWidgets.QLabel(Form)

self.label_2.setObjectName("label_2")

self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)

self.cbObjType = QtWidgets.QComboBox(Form)

self.cbObjType.setObjectName("cbObjType")

self.cbObjType.addItem("")

self.cbObjType.addItem("")

self.gridLayout.addWidget(self.cbObjType, 0, 1, 1, 1)

self.btnCreate = QtWidgets.QPushButton(Form)

self.btnCreate.setObjectName("btnCreate")

self.gridLayout.addWidget(self.btnCreate, 0, 2, 1, 1)

self.label = QtWidgets.QLabel(Form)

self.label.setObjectName("label")

self.gridLayout.addWidget(self.label, 1, 0, 1, 1)

self.leNewName = QtWidgets.QLineEdit(Form)

self.leNewName.setObjectName("leNewName")

self.gridLayout.addWidget(self.leNewName, 1, 1, 1, 1)

self.btnRename = QtWidgets.QPushButton(Form)

self.btnRename.setObjectName("btnRename")

self.gridLayout.addWidget(self.btnRename, 1, 2, 1, 1)

self.retranslateUi(Form)

QtCore.QMetaObject.connectSlotsByName(Form)

开发者ID:WendyAndAndy,项目名称:MayaDev,代码行数:30,

示例13: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self, node):

super().__init__()

self.node: NetworkNode = node

self.delete_popup = None

self.layout = QGridLayout()

self.table = QTableWidget(0, 3)

self.table.setHorizontalHeaderLabels(['Id', 'Key', 'Value'])

self.table.setColumnHidden(0, True)

self.node.configuration.configuration_changed.connect(

self.handle_configuration_change

)

self.table.cellChanged.connect(self.handle_cell_change)

self.layout.addWidget(self.table, 0, 0, 1, 2)

self.deleteButton = QPushButton('Remove Selected Row')

self.deleteButton.clicked.connect(

self.handle_delete_action

)

self.layout.addWidget(self.deleteButton, 1, 0)

self.addButton = QPushButton('Add Configuration')

self.addButton.clicked.connect(

self.handle_add_action

)

self.layout.addWidget(self.addButton, 1, 1)

self.setLayout(self.layout)

#################################

# Add/Update/Get for table rows #

#################################

开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:41,

示例14: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self, button_text: str, copy_text: str):

super(CopyButton, self).__init__()

self.copy_text = copy_text

self.button_text = button_text

self.button = QPushButton(button_text)

# noinspection PyUnresolvedReferences

self.button.clicked.connect(self.copy)

self.addWidget(self.button)

self.timer = QTimer(self.parentWidget())

开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:11,

示例15: itemAeropython

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def itemAeropython(self):

form = QtWidgets.QFormLayout()

label1 = QtWidgets.QLabel(u'Angle of attack (°)')

self.aoa = QtWidgets.QDoubleSpinBox()

self.aoa.setSingleStep(0.1)

self.aoa.setDecimals(1)

self.aoa.setRange(-10.0, 10.0)

self.aoa.setValue(0.0)

form.addRow(label1, self.aoa)

label2 = QtWidgets.QLabel('Freestream velocity (m/s)')

self.freestream = QtWidgets.QDoubleSpinBox()

self.freestream.setSingleStep(0.1)

self.freestream.setDecimals(2)

self.freestream.setRange(0.0, 100.0)

self.freestream.setValue(10.0)

form.addRow(label2, self.freestream)

label3 = QtWidgets.QLabel('Number of panels (-)')

self.panels = QtWidgets.QSpinBox()

self.panels.setRange(10, 500)

self.panels.setValue(40)

form.addRow(label3, self.panels)

panelMethodButton = QtWidgets.QPushButton('Calculate lift coefficient')

form.addRow(panelMethodButton)

self.item_ap = QtWidgets.QGroupBox('AeroPython Panel Method')

self.item_ap.setLayout(form)

panelMethodButton.clicked.connect(self.runPanelMethod)

开发者ID:chiefenne,项目名称:PyAero,代码行数:35,

示例16: itemContourAnalysis

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def itemContourAnalysis(self):

box = QtWidgets.QVBoxLayout()

vlayout = QtWidgets.QVBoxLayout()

gb = QtWidgets.QGroupBox('Select contour to analyze')

self.b1 = QtWidgets.QRadioButton('Original')

self.b2 = QtWidgets.QRadioButton('Refined')

self.b2.setChecked(True)

vlayout.addWidget(self.b1)

vlayout.addWidget(self.b2)

gb.setLayout(vlayout)

box.addWidget(gb)

vlayout = QtWidgets.QVBoxLayout()

self.cgb = QtWidgets.QGroupBox('Select plot quantity')

self.cpb1 = QtWidgets.QRadioButton('Gradient')

self.cpb2 = QtWidgets.QRadioButton('Curvature')

self.cpb3 = QtWidgets.QRadioButton('Radius of Curvature')

self.cpb1.setChecked(True)

vlayout.addWidget(self.cpb1)

vlayout.addWidget(self.cpb2)

vlayout.addWidget(self.cpb3)

self.cgb.setLayout(vlayout)

self.cgb.setEnabled(False)

box.addWidget(self.cgb)

analyzeButton = QtWidgets.QPushButton('Analyze Contour')

analyzeButton.setGeometry(10, 10, 200, 50)

box.addWidget(analyzeButton)

box.addStretch(1)

self.item_ca = QtWidgets.QWidget()

self.item_ca.setLayout(box)

analyzeButton.clicked.connect(self.analyzeAirfoil)

开发者ID:chiefenne,项目名称:PyAero,代码行数:39,

示例17: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self, remotePath: str, targetPath: str, isMultipleDownload: bool, parent: QObject):

super().__init__(parent, Qt.CustomizeWindowHint | Qt.WindowTitleHint)

self.titleLabel = QLabel(f"Downloading {remotePath} to {targetPath}")

self.progressBar = QProgressBar()

self.progressBar.setMinimum(0)

self.progressBar.setMaximum(0)

self.actualProgress = 0

self.actualMaximum = 0

self.isComplete = False

self.isMultipleDownload = isMultipleDownload

self.downloadCount = 0

self.downloadTotal = 0

self.progressLabel = QLabel(f"{self.downloadCount} / {self.downloadTotal} files downloaded")

self.progressSizeLabel = QLabel("0 bytes")

self.widgetLayout = QVBoxLayout()

self.widgetLayout.addWidget(self.titleLabel)

self.widgetLayout.addWidget(self.progressLabel)

self.widgetLayout.addWidget(self.progressBar)

self.widgetLayout.addWidget(self.progressSizeLabel)

self.closeButton = QPushButton("Continue download in background")

self.closeButton.clicked.connect(self.hide)

self.widgetLayout.addWidget(self.closeButton)

self.setLayout(self.widgetLayout)

开发者ID:GoSecure,项目名称:pyrdp,代码行数:33,

示例18: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__ (self, parent):

QtWidgets.QDialog.__init__(self, parent)

self.setWindowTitle("Export depth maps")

self.btnQuit = QtWidgets.QPushButton("&Close")

self.btnP1 = QtWidgets.QPushButton("&Export")

self.pBar = QtWidgets.QProgressBar()

self.pBar.setTextVisible(False)

# self.selTxt =QtWidgets.QLabel()

# self.selTxt.setText("Apply to:")

self.radioBtn_all = QtWidgets.QRadioButton("Apply to all cameras")

self.radioBtn_sel = QtWidgets.QRadioButton("Apply to selected")

self.radioBtn_all.setChecked(True)

self.radioBtn_sel.setChecked(False)

self.formTxt = QtWidgets.QLabel()

self.formTxt.setText("Export format:")

self.formCmb = QtWidgets.QComboBox()

self.formCmb.addItem("1-band F32")

self.formCmb.addItem("Grayscale 8-bit")

self.formCmb.addItem("Grayscale 16-bit")

# creating layout

layout = QtWidgets.QGridLayout()

layout.setSpacing(10)

layout.addWidget(self.radioBtn_all, 0, 0)

layout.addWidget(self.radioBtn_sel, 1, 0)

layout.addWidget(self.formTxt, 0, 1)

layout.addWidget(self.formCmb, 1, 1)

layout.addWidget(self.btnP1, 2, 0)

layout.addWidget(self.btnQuit, 2, 1)

layout.addWidget(self.pBar, 3, 0, 1, 2)

self.setLayout(layout)

QtCore.QObject.connect(self.btnP1, QtCore.SIGNAL("clicked()"), self.export_depth)

QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()"))

self.exec()

开发者ID:agisoft-llc,项目名称:metashape-scripts,代码行数:41,

示例19: __init__

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def __init__(self, parent):

QtWidgets.QDialog.__init__(self, parent)

self.setWindowTitle("Copy bounding box")

self.labelFrom = QtWidgets.QLabel("From")

self.labelTo = QtWidgets.QLabel("To")

self.fromChunk = QtWidgets.QComboBox()

for chunk in Metashape.app.document.chunks:

self.fromChunk.addItem(chunk.label)

self.toChunks = QtWidgets.QListWidget()

self.toChunks.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)

for chunk in Metashape.app.document.chunks:

self.toChunks.addItem(chunk.label)

self.btnOk = QtWidgets.QPushButton("Ok")

self.btnOk.setFixedSize(90, 50)

self.btnOk.setToolTip("Copy bounding box to all selected chunks")

self.btnQuit = QtWidgets.QPushButton("Close")

self.btnQuit.setFixedSize(90, 50)

layout = QtWidgets.QGridLayout() # creating layout

layout.addWidget(self.labelFrom, 0, 0)

layout.addWidget(self.fromChunk, 0, 1)

layout.addWidget(self.labelTo, 0, 2)

layout.addWidget(self.toChunks, 0, 3)

layout.addWidget(self.btnOk, 1, 1)

layout.addWidget(self.btnQuit, 1, 3)

self.setLayout(layout)

QtCore.QObject.connect(self.btnOk, QtCore.SIGNAL("clicked()"), self.copyBoundingBox)

QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()"))

self.exec()

开发者ID:agisoft-llc,项目名称:metashape-scripts,代码行数:42,

示例20: fontNormal_action

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def fontNormal_action(self, uiClass_list=[]):

if len(uiClass_list) == 0:

uiClass_list = 'QLabel,QPushButton'.split(',')

self.memoData['font_size'] = self.memoData['font_size_default']

self.setStyleSheet( "{0} { font-size: {1}pt;}".format(','.join(uiClass_list), self.memoData['font_size']) )

开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:7,

示例21: fontUp_action

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def fontUp_action(self, uiClass_list=[]):

if len(uiClass_list) == 0:

uiClass_list = 'QLabel,QPushButton'.split(',')

self.memoData['font_size'] += 2

self.setStyleSheet( "{0} { font-size: {1}pt;}".format(','.join(uiClass_list), self.memoData['font_size']) )

开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:7,

示例22: fontDown_action

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def fontDown_action(self, uiClass_list=[]):

if len(uiClass_list) == 0:

uiClass_list = 'QLabel,QPushButton'.split(',')

if self.memoData['font_size'] >= self.memoData['font_size_default']:

self.memoData['font_size'] -= 2

self.setStyleSheet( "{0} { font-size: {1}pt;}".format(','.join(uiClass_list), self.memoData['font_size']) )

开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:8,

示例23: setLang

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def setLang(self, langName):

lang_data = self.memoData['lang'][langName]

for ui_name in lang_data.keys():

if ui_name in self.uiList.keys() and lang_data[ui_name] != '':

ui_element = self.uiList[ui_name]

# '' means no translation availdanle in that data file

if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):

# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox

ui_element.setText(lang_data[ui_name])

elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):

# uiType: QMenu, QGroupBox

ui_element.setTitle(lang_data[ui_name])

elif isinstance(ui_element, QtWidgets.QTabWidget):

# uiType: QTabWidget

tabCnt = ui_element.count()

tabNameList = lang_data[ui_name].split(';')

if len(tabNameList) == tabCnt:

for i in range(tabCnt):

if tabNameList[i] != '':

ui_element.setTabText(i,tabNameList[i])

elif isinstance(ui_element, QtWidgets.QComboBox):

# uiType: QComboBox

itemCnt = ui_element.count()

itemNameList = lang_data[ui_name].split(';')

ui_element.clear()

ui_element.addItems(itemNameList)

elif isinstance(ui_element, QtWidgets.QTreeWidget):

# uiType: QTreeWidget

labelCnt = ui_element.headerItem().columnCount()

labelList = lang_data[ui_name].split(';')

ui_element.setHeaderLabels(labelList)

elif isinstance(ui_element, QtWidgets.QTableWidget):

# uiType: QTableWidget

colCnt = ui_element.columnCount()

headerList = lang_data[ui_name].split(';')

cur_table.setHorizontalHeaderLabels( headerList )

elif isinstance(ui_element, (str, unicode) ):

# uiType: string for msg

self.uiList[ui_name] = lang_data[ui_name]

开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:41,

示例24: fontNormal_action

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def fontNormal_action(self):

self.memoData['font_size'] = self.memoData['font_size_default']

self.setStyleSheet("QLabel,QPushButton { font-size: %dpt;}" % self.memoData['font_size'])

开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:5,

示例25: fontUp_action

​点赞 5

# 需要导入模块: from PySide2 import QtWidgets [as 别名]

# 或者: from PySide2.QtWidgets import QPushButton [as 别名]

def fontUp_action(self):

self.memoData['font_size'] += 2

self.setStyleSheet("QLabel,QPushButton { font-size: %dpt;}" % self.memoData['font_size'])

开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:5,

注:本文中的PySide2.QtWidgets.QPushButton方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。

你可能感兴趣的:(python,qt,按钮)