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


Python QtWidgets.QButtonGroup方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def __init__(self):
        # === App-Init ===
        super(SidebarWindow, self).__init__()
        self._title = "Pyleecan"
        self.setWindowTitle(self._title)
        self._main = QtWidgets.QWidget()
        self.setCentralWidget(self._main)

        # === Main Widgets ===
        # Navigation Panel with Button Group
        self.nav_panel = QtWidgets.QFrame()

        self.nav_btn_grp = QtWidgets.QButtonGroup()
        self.nav_btn_grp.setExclusive(True)
        self.nav_btn_grp.buttonClicked[int].connect(self.switch_stack)
        self.btn_grp_fct = []

        self.nav_layout = QtWidgets.QVBoxLayout(self.nav_panel)
        self.nav_layout.setContentsMargins(2, 2, 2, 2)
        self.nav_layout.addStretch(1)  # add stretch first

        # Sub Window Stack
        self.io_stack = QtWidgets.QStackedWidget(self)

        # Seperator Line
        line = QtWidgets.QFrame()
        line.setStyleSheet("QFrame { background-color: rgb(200, 200, 200) }")
        line.setFixedWidth(2)

        # === Main Layout ===
        main_layout = QtWidgets.QHBoxLayout()
        main_layout.addWidget(self.nav_panel)
        main_layout.addWidget(line)
        main_layout.addWidget(self.io_stack)

        self._main.setLayout(main_layout)

        self.show()
        self.centerOnScreen() 
开发者ID:Eomys,项目名称:pyleecan,代码行数:41,代码来源:SidebarWindow.py

示例2: _initUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def _initUi(self, name, baseDate):
        self.setWindowTitle('波动分布[{0}]'.format(name))
 
        # 控件
        forwardNTDaysLabel = QLabel('基准日期[{0}]向前N日(不包含基准日期)'.format(baseDate))
        self._forwardNTDaysLineEdit = QLineEdit('30')

        # 自身波动和绝对波动
        # 个股绝对波动 = 个股自身波动 + 大盘波动
        selfVolatilityRadioButton = QRadioButton('自身波动'); selfVolatilityRadioButton.setChecked(True)
        selfVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        absoluteVolatilityRadioButton = QRadioButton('绝对波动')
        absoluteVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        # 添加到QButtonGroup
        self._volatilityButtonGroup = QButtonGroup()
        self._volatilityButtonGroup.addButton(selfVolatilityRadioButton, 1); 
        self._volatilityButtonGroup.addButton(absoluteVolatilityRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(forwardNTDaysLabel, 0, 0)
        grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)

        grid.addWidget(selfVolatilityRadioButton, 1, 0)
        grid.addWidget(absoluteVolatilityRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:43,代码来源:DyStockVolatilityDistDlg.py

示例3: _initUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def _initUi(self, dlgName):
        self.setWindowTitle(dlgName)
 
        allRadioButton = QRadioButton('所有'); allRadioButton.setChecked(True)
        highlightRadioButton = QRadioButton('高亮')

        # 添加到QButtonGroup
        self._buttonGroup = QButtonGroup()
        self._buttonGroup.addButton(allRadioButton, 1); 
        self._buttonGroup.addButton(highlightRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(allRadioButton, 1, 0)
        grid.addWidget(highlightRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:30,代码来源:DyStockTableSelectDlg.py

示例4: _initUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def _initUi(self, title, backward):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join([str(x) for x in self._data['days']]) if self._data else '1,2,3,4,5,10')

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后')
        if backward:
            backwardRadioButton.setChecked(True)
        else:
            forwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1)
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:43,代码来源:DyStockTableAddColumnsDlg.py

示例5: _initUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def _initUi(self, title):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join(self._data['days']) if self._data else '1,2,3,4,5,10')

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后'); backwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1); 
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:39,代码来源:DyStockSelectAddColumnsDlg.py

示例6: _initUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def _initUi(self, strategyName):
        self.setWindowTitle('[{0}]另存为'.format(strategyName))
 
        allRadioButton = QRadioButton('所有'); allRadioButton.setChecked(True)
        highlightRadioButton = QRadioButton('高亮')

        # 添加到QButtonGroup
        self._buttonGroup = QButtonGroup()
        self._buttonGroup.addButton(allRadioButton, 1); 
        self._buttonGroup.addButton(highlightRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(allRadioButton, 1, 0)
        grid.addWidget(highlightRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:30,代码来源:DyStockSelectSaveAsDlg.py

示例7: create_chart_type_group

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def create_chart_type_group(self):
    vbox = QtWidgets.QVBoxLayout()
    self.rg_chart_type = QtWidgets.QButtonGroup()
    self.rg_chart_type.setExclusive(True)

    for i, choice in enumerate(self.config.chart_types):
      radio = QtWidgets.QRadioButton(choice)
      self.rg_chart_type.addButton(radio, i)
      if i == self.config.chart_type: 
        radio.setChecked(True)
      vbox.addWidget(radio)

    vbox.addStretch(1)
    self.rg_chart_type.buttonClicked.connect(self.bg_graph_type_changed)
    return vbox 
开发者ID:danigargu,项目名称:IDAtropy,代码行数:17,代码来源:IDAtropy.py

示例8: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def setupUi(self, Widget):

        # widgety rysujące kształty, instancje klasy Ksztalt
        self.ksztalt1 = Ksztalt(self, Ksztalty.Polygon)
        self.ksztalt2 = Ksztalt(self, Ksztalty.Ellipse)
        self.ksztaltAktywny = self.ksztalt1

        # przyciski CheckBox ###
        uklad = QVBoxLayout()  # układ pionowy
        self.grupaChk = QButtonGroup()
        for i, v in enumerate(('Kwadrat', 'Koło', 'Trójkąt', 'Linia')):
            self.chk = QCheckBox(v)
            self.grupaChk.addButton(self.chk, i)
            uklad.addWidget(self.chk)
        self.grupaChk.buttons()[self.ksztaltAktywny.ksztalt].setChecked(True)
        # CheckBox do wyboru aktywnego kształtu
        self.ksztaltChk = QCheckBox('<=')
        self.ksztaltChk.setChecked(True)
        uklad.addWidget(self.ksztaltChk)

        # układ poziomy dla kształtów oraz przycisków CheckBox
        ukladH1 = QHBoxLayout()
        ukladH1.addWidget(self.ksztalt1)
        ukladH1.addLayout(uklad)
        ukladH1.addWidget(self.ksztalt2)
        # koniec CheckBox ###

        self.setLayout(ukladH1)  # przypisanie układu do okna głównego
        self.setWindowTitle('Widżety') 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:31,代码来源:gui_z2.py

示例9: _initUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def _initUi(self, title, backward):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join([str(x) for x in self._data['days']]) if self._data else '2,3,4,5,10' )

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后');
        if backward:
            backwardRadioButton.setChecked(True)
        else:
            forwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1); 
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
开发者ID:shakenetwork,项目名称:DevilYuan,代码行数:43,代码来源:DyStockTableAddColumnsDlg.py

示例10: _initUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def _initUi(self, title):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join(self._data['days']) if self._data else '2,3,4,5,10' )

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后'); backwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1); 
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
开发者ID:shakenetwork,项目名称:DevilYuan,代码行数:39,代码来源:DyStockSelectAddColumnsDlg.py

示例11: featureCombination

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def featureCombination(self):

        groupBox = QtWidgets.QGroupBox("Feature Combination Method")

        combination_method = QtWidgets.QButtonGroup()  # Number group

        self.sum_feats = QtWidgets.QRadioButton("sum")
        self.mul_feats = QtWidgets.QRadioButton("product")

        if self.configuration["feature_combination"]["type"] == "product":
            self.mul_feats.setChecked(True)
        else:
            self.sum_feats.setChecked(True)

        combination_method.addButton(self.sum_feats)
        combination_method.addButton(self.mul_feats)
        self.sum_feats.clicked.connect(self.onSignalRate)
        self.mul_feats.clicked.connect(self.onSignalRate)
        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(self.sum_feats)
        hbox.addWidget(self.mul_feats)
        groupBox.setLayout(hbox)
        groupBox.setVisible(True)
        return groupBox

    # reading of textgrids and lab, use previously selected tiers 
开发者ID:asuni,项目名称:wavelet_prosody_toolkit,代码行数:28,代码来源:wavelet_gui.py

示例12: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def setupUi(self, Dialog_attribute_type):
        Dialog_attribute_type.setObjectName("Dialog_attribute_type")
        Dialog_attribute_type.resize(400, 188)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog_attribute_type)
        self.buttonBox.setGeometry(QtCore.QRect(160, 130, 211, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.radioButton_char = QtWidgets.QRadioButton(Dialog_attribute_type)
        self.radioButton_char.setGeometry(QtCore.QRect(30, 60, 161, 22))
        self.radioButton_char.setChecked(True)
        self.radioButton_char.setObjectName("radioButton_char")
        self.buttonGroup = QtWidgets.QButtonGroup(Dialog_attribute_type)
        self.buttonGroup.setObjectName("buttonGroup")
        self.buttonGroup.addButton(self.radioButton_char)
        self.radioButton_numeric = QtWidgets.QRadioButton(Dialog_attribute_type)
        self.radioButton_numeric.setGeometry(QtCore.QRect(30, 90, 171, 22))
        self.radioButton_numeric.setObjectName("radioButton_numeric")
        self.buttonGroup.addButton(self.radioButton_numeric)
        self.label = QtWidgets.QLabel(Dialog_attribute_type)
        self.label.setGeometry(QtCore.QRect(20, 20, 241, 17))
        self.label.setObjectName("label")

        self.retranslateUi(Dialog_attribute_type)
        self.buttonBox.accepted.connect(Dialog_attribute_type.accept)
        self.buttonBox.rejected.connect(Dialog_attribute_type.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog_attribute_type) 
开发者ID:ccbogel,项目名称:QualCoder,代码行数:29,代码来源:ui_dialog_attribute_type.py

示例13: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def setupUi(self, Dialog_assignAttribute):
        Dialog_assignAttribute.setObjectName("Dialog_assignAttribute")
        Dialog_assignAttribute.resize(487, 148)
        self.radioButton_cases = QtWidgets.QRadioButton(Dialog_assignAttribute)
        self.radioButton_cases.setGeometry(QtCore.QRect(180, 19, 81, 20))
        self.radioButton_cases.setChecked(True)
        self.radioButton_cases.setObjectName("radioButton_cases")
        self.buttonGroup = QtWidgets.QButtonGroup(Dialog_assignAttribute)
        self.buttonGroup.setObjectName("buttonGroup")
        self.buttonGroup.addButton(self.radioButton_cases)
        self.radioButton_files = QtWidgets.QRadioButton(Dialog_assignAttribute)
        self.radioButton_files.setGeometry(QtCore.QRect(280, 19, 81, 20))
        self.radioButton_files.setObjectName("radioButton_files")
        self.buttonGroup.addButton(self.radioButton_files)
        self.label = QtWidgets.QLabel(Dialog_assignAttribute)
        self.label.setGeometry(QtCore.QRect(20, 20, 171, 17))
        self.label.setObjectName("label")
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog_assignAttribute)
        self.buttonBox.setGeometry(QtCore.QRect(130, 80, 221, 27))
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.retranslateUi(Dialog_assignAttribute)
        self.buttonBox.accepted.connect(Dialog_assignAttribute.accept)
        self.buttonBox.rejected.connect(Dialog_assignAttribute.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog_assignAttribute) 
开发者ID:ccbogel,项目名称:QualCoder,代码行数:28,代码来源:ui_dialog_assign_attribute.py

示例14: initDrawButtons

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def initDrawButtons(self, flags):
        self.drawButtonGroup = QButtonGroup(self)

        # draw action buttons
        if flags & constant.RECT:
            self.rectButton = QPushButton(self)
            self.rectButton.setIcon(QIcon(":/resource/icon/rect.png"))
            self.rectButton.setFixedSize(self.iconWidth, self.iconHeight)
            self.rectButton.setCheckable(True)
            self.drawButtonGroup.addButton(self.rectButton)
            self.hlayout.addWidget(self.rectButton)
            self.button_list.append(self.rectButton)

        if flags & constant.ELLIPSE:
            self.ellipseButton = QPushButton(self)
            self.ellipseButton.setIcon(QIcon(":/resource/icon/ellipse.png"))
            self.ellipseButton.setFixedSize(self.iconWidth, self.iconHeight)
            self.ellipseButton.setCheckable(True)
            self.drawButtonGroup.addButton(self.ellipseButton)
            self.hlayout.addWidget(self.ellipseButton)
            self.button_list.append(self.ellipseButton)

        if flags & constant.ARROW:
            self.arrowButton = QPushButton(self)
            self.arrowButton.setIcon(QIcon(":/resource/icon/arrow.png"))
            self.arrowButton.setFixedSize(self.iconWidth, self.iconHeight)
            self.arrowButton.setCheckable(True)
            self.drawButtonGroup.addButton(self.arrowButton)
            self.hlayout.addWidget(self.arrowButton)
            self.button_list.append(self.arrowButton)

        if flags & constant.LINE:
            self.lineButton = QPushButton(self)
            self.lineButton.setIcon(QIcon(":/resource/icon/line.png"))
            self.lineButton.setFixedSize(self.iconWidth, self.iconHeight)
            self.lineButton.setCheckable(True)
            self.drawButtonGroup.addButton(self.lineButton)
            self.hlayout.addWidget(self.lineButton)
            self.button_list.append(self.lineButton)

        if flags & constant.FREEPEN:
            self.freePenButton = QPushButton(self)
            self.freePenButton.setIcon(QIcon(":/resource/icon/pen.png"))
            self.freePenButton.setFixedSize(self.iconWidth, self.iconHeight)
            self.freePenButton.setCheckable(True)
            self.drawButtonGroup.addButton(self.freePenButton)
            self.hlayout.addWidget(self.freePenButton)
            self.button_list.append(self.freePenButton)

        if flags & constant.TEXT:
            self.textButton = QPushButton(self)
            self.textButton.setIcon(QIcon(":/resource/icon/text.png"))
            self.textButton.setFixedSize(self.iconWidth, self.iconHeight)
            self.textButton.setCheckable(True)
            self.drawButtonGroup.addButton(self.textButton)
            self.hlayout.addWidget(self.textButton)
            self.button_list.append(self.textButton)

        self.drawButtonGroup.buttonClicked.connect(self.buttonToggled) 
开发者ID:SeptemberHX,项目名称:screenshot,代码行数:61,代码来源:toolbar.py

示例15: _initUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QButtonGroup [as 别名]
def _initUi(self):
        self.setWindowTitle('指数均线K线图统计')
 
        # 控件
        startDateLable = QLabel('开始日期')
        self._startDateLineEdit = QLineEdit(datetime.now().strftime("%Y-%m-%d"))

        endDateLable = QLabel('结束日期')
        self._endDateLineEdit = QLineEdit(datetime.now().strftime("%Y-%m-%d"))

        # 指数和股票代码
        shIndexRadioButton = QRadioButton('上证指数'); shIndexRadioButton.setChecked(True)
        szIndexRadioButton = QRadioButton('深证成指')
        cybIndexRadioButton = QRadioButton('创业板指')
        zxbIndexRadioButton = QRadioButton('中小板指')

        hs300IndexRadioButton = QRadioButton('沪深300')
        zz500IndexRadioButton = QRadioButton('中证500')

        # 添加到QButtonGroup
        self._stocksButtonGroup = QButtonGroup()
        self._stocksButtonGroup.addButton(shIndexRadioButton, 1); 
        self._stocksButtonGroup.addButton(szIndexRadioButton, 2)
        self._stocksButtonGroup.addButton(cybIndexRadioButton, 3)
        self._stocksButtonGroup.addButton(zxbIndexRadioButton, 4)

        self._stocksButtonGroup.addButton(hs300IndexRadioButton, 4)
        self._stocksButtonGroup.addButton(zz500IndexRadioButton, 4)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(startDateLable, 0, 0)
        grid.addWidget(self._startDateLineEdit, 1, 0)

        grid.addWidget(endDateLable, 0, 1)
        grid.addWidget(self._endDateLineEdit, 1, 1)

        grid.addWidget(shIndexRadioButton, 2, 0)
        grid.addWidget(szIndexRadioButton, 2, 1)
        grid.addWidget(cybIndexRadioButton, 3, 0)
        grid.addWidget(zxbIndexRadioButton, 3, 1)

        grid.addWidget(hs300IndexRadioButton, 4, 0)
        grid.addWidget(zz500IndexRadioButton, 4, 1)

        grid.addWidget(okPushButton, 5, 1)
        grid.addWidget(cancelPushButton, 5, 0)
 
        self.setLayout(grid) 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:58,代码来源:DyStockSelectIndexMaKChartStatsDlg.py


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