当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QPushButton方法代码示例

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


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

示例1: __init__

# 需要导入模块: 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,代码来源:widgets.py

示例2: __init__

# 需要导入模块: 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,代码来源:dialog.py

示例3: __init__

# 需要导入模块: 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,代码来源:button_and_long_process.py

示例4: __init__

# 需要导入模块: 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,代码来源:button_with_sizepolicy.py

示例5: createTweetsGroupBox

# 需要导入模块: 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,代码来源:twitter_dapp.py

示例6: setupUi

# 需要导入模块: 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,代码来源:MyWindow_ui.py

示例7: setLang

# 需要导入模块: 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,代码来源:UITranslator.py

示例8: __init__

# 需要导入模块: 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,代码来源:colorwheel.py

示例9: __init__

# 需要导入模块: 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,代码来源:button_and_label.py

示例10: __init__

# 需要导入模块: 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,代码来源:button_and_dialog.py

示例11: __init__

# 需要导入模块: 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,代码来源:button_and_list.py

示例12: setupUi

# 需要导入模块: 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,代码来源:guiDemo_ui.py

示例13: __init__

# 需要导入模块: 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,代码来源:configuration.py

示例14: __init__

# 需要导入模块: 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,代码来源:copy_button.py

示例15: itemAeropython

# 需要导入模块: 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,代码来源:ToolBox.py


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