本文整理汇总了Python中PyQt5.QtWidgets.QRadioButton方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QRadioButton方法的具体用法?Python QtWidgets.QRadioButton怎么用?Python QtWidgets.QRadioButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QRadioButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _on_behavior_changed
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def _on_behavior_changed(self):
"""
Display a warning about bare filenames if user selects the
override option and disables wrapping the field with a [sound]
tag.
"""
if self.isVisible():
append = self.findChild(QtWidgets.QRadioButton, 'append')
behavior = self.findChild(Checkbox, 'behavior')
if not (append.isChecked() or behavior.isChecked()):
self._alerts(
'Please note that if you use bare filenames, the "Check '
'Media" feature in Anki will not detect those audio '
"files as in-use, even if you insert the field into your "
"templates.",
self,
)
示例2: _init_controls
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def _init_controls(self, parent):
group = QtWidgets.QGroupBox()
group.setFlat(True)
layout = QtWidgets.QHBoxLayout()
custom_mode = QtWidgets.QRadioButton('Mode Custom')
custom_mode.setToolTip('Manually select the axis slice on sagittal plane')
custom_mode.toggled.connect(self.on_toggle_mode)
custom_mode.mode = 'CUSTOM'
custom_mode.sagittal_title = 'Select an axial slice.\n{}'.format(self.params.subtitle)
custom_mode.axial_title = 'Select the center of the spinal cord'
layout.addWidget(custom_mode)
auto_mode = QtWidgets.QRadioButton('Mode Auto')
auto_mode.setToolTip('Automatically move down the axis slice on the sagittal plane')
auto_mode.toggled.connect(self.on_toggle_mode)
auto_mode.mode = 'AUTO'
auto_mode.sagittal_title = 'The axial slice is automatically selected\n{}'.format(self.params.subtitle)
auto_mode.axial_title = 'Click in the center of the spinal cord'
layout.addWidget(auto_mode)
group.setLayout(layout)
parent.addWidget(group)
auto_mode.click()
示例3: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(398, 170)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setGeometry(QtCore.QRect(30, 130, 341, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.emptyButton = QtWidgets.QRadioButton(Dialog)
self.emptyButton.setGeometry(QtCore.QRect(40, 100, 99, 21))
self.emptyButton.setObjectName("emptyButton")
self.newButton = QtWidgets.QRadioButton(Dialog)
self.newButton.setGeometry(QtCore.QRect(40, 20, 141, 21))
self.newButton.setObjectName("newButton")
self.useButton = QtWidgets.QRadioButton(Dialog)
self.useButton.setGeometry(QtCore.QRect(40, 60, 70, 21))
self.useButton.setObjectName("useButton")
self.fileList = QtWidgets.QComboBox(Dialog)
self.fileList.setGeometry(QtCore.QRect(130, 60, 171, 23))
self.fileList.setObjectName("fileList")
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept)
self.buttonBox.rejected.connect(Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例4: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.ui = Ui_DialogFilterBandwidth()
self.ui.setupUi(self)
self.setWindowFlags(Qt.Window)
bw_type = settings.read("bandpass_filter_bw_type", "Medium", str)
custom_bw = settings.read("bandpass_filter_custom_bw", 0.1, float)
for item in dir(self.ui):
item = getattr(self.ui, item)
if isinstance(item, QLabel):
name = item.objectName().replace("label", "")
key = next((key for key in Filter.BANDWIDTHS.keys() if name.startswith(key.replace(" ", ""))), None)
if key is not None and name.endswith("Bandwidth"):
item.setText("{0:n}".format(Filter.BANDWIDTHS[key]))
elif key is not None and name.endswith("KernelLength"):
item.setText(str(Filter.get_filter_length_from_bandwidth(Filter.BANDWIDTHS[key])))
elif isinstance(item, QRadioButton):
item.setChecked(bw_type.replace(" ", "_") == item.objectName().replace("radioButton", ""))
self.ui.doubleSpinBoxCustomBandwidth.setValue(custom_bw)
self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(custom_bw))
self.create_connects()
示例5: setupChecks
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def setupChecks(self, multiselect, disabled=[], default=None, exclude=[]):
# This simres is only used to get the list of channels available
simres = motorlib.simResult.SimulationResult(motorlib.motor.Motor())
for channel in simres.channels:
if channel not in exclude:
if multiselect:
check = QCheckBox(simres.channels[channel].name)
else:
check = QRadioButton(simres.channels[channel].name)
self.layout().addWidget(check)
self.checks[channel] = check
if default is not None:
if multiselect:
if channel in default:
self.checks[channel].setCheckState(2)
else:
self.checks[channel].setChecked(channel == default)
self.checks[channel].toggled.connect(self.checksChanged.emit)
if channel in disabled:
check.setEnabled(False)
示例6: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def __init__(self, parent=None):
super(LayerWidget, self).__init__(parent)
layout = QtWidgets.QVBoxLayout(self)
self.treewidget = LayerTreeWidget(parent=self, viewer=parent)
layout.addWidget(self.treewidget)
foo = QtWidgets.QHBoxLayout()
self.button_bw = QtWidgets.QRadioButton("B/W mode ")
self.button_co = QtWidgets.QRadioButton("RGB mode ")
self.button_bw.setChecked(True)
foo.addWidget(self.button_bw)
foo.addWidget(self.button_co)
layout.addLayout(foo)
self.button_bw.clicked.connect(self.bwmode)
self.button_co.clicked.connect(self.rgbmode)
self.viewer = parent
示例7: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def setupUi(self, IDAngrTextViewer):
IDAngrTextViewer.setObjectName("IDAngrTextViewer")
IDAngrTextViewer.resize(812, 612)
self.gridLayout = QtWidgets.QGridLayout(IDAngrTextViewer)
self.gridLayout.setObjectName("gridLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.plainBox = QtWidgets.QRadioButton(IDAngrTextViewer)
self.plainBox.setChecked(True)
self.plainBox.setObjectName("plainBox")
self.horizontalLayout.addWidget(self.plainBox)
self.hexBox = QtWidgets.QRadioButton(IDAngrTextViewer)
self.hexBox.setObjectName("hexBox")
self.horizontalLayout.addWidget(self.hexBox)
self.pyBox = QtWidgets.QRadioButton(IDAngrTextViewer)
self.pyBox.setObjectName("pyBox")
self.horizontalLayout.addWidget(self.pyBox)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
self.plainTextEdit = QtWidgets.QPlainTextEdit(IDAngrTextViewer)
self.plainTextEdit.setReadOnly(True)
self.plainTextEdit.setPlainText("")
self.plainTextEdit.setObjectName("plainTextEdit")
self.gridLayout.addWidget(self.plainTextEdit, 1, 0, 1, 1)
self.retranslateUi(IDAngrTextViewer)
QtCore.QMetaObject.connectSlotsByName(IDAngrTextViewer)
示例8: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def setupUi(self, Form):
Form.setObjectName("SelectHWDevice")
self.lay_main = QtWidgets.QVBoxLayout(Form)
self.lay_main.setContentsMargins(-1, 3, -1, 3)
self.lay_main.setObjectName("lay_main")
self.gb_devices = QtWidgets.QGroupBox(Form)
self.gb_devices.setFlat(False)
self.gb_devices.setCheckable(False)
self.gb_devices.setObjectName("gb_devices")
self.lay_main.addWidget(self.gb_devices)
self.lay_devices = QtWidgets.QVBoxLayout(self.gb_devices)
for idx, dev in enumerate(self.device_list):
rb = QRadioButton(self.gb_devices)
rb.setText(dev)
rb.toggled.connect(partial(self.on_item_toggled, idx))
self.device_radiobutton_list.append(rb)
self.lay_devices.addWidget(rb)
self.btn_main = QtWidgets.QDialogButtonBox(Form)
self.btn_main.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
self.btn_main.setObjectName("btn_main")
self.lay_main.addWidget(self.btn_main)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
self.setFixedSize(self.sizeHint())
示例9: _initUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [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)
示例10: _initUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [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)
示例11: _initUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [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)
示例12: _initUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [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)
示例13: _initUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [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)
示例14: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def __init__(
self, title, choices, description, default_choice, toggle_function, parent=None
):
super().__init__(parent)
self.toggle_function = toggle_function
self.setTitle(title)
self.layout = QtWidgets.QVBoxLayout(self)
self.setLayout(self.layout)
self.layout.addWidget(QtWidgets.QLabel(description, self))
self.option_1 = QtWidgets.QRadioButton(choices[0], self)
self.layout.addWidget(self.option_1)
self.option_2 = QtWidgets.QRadioButton(choices[1], self)
self.layout.addWidget(self.option_2)
self.option_1.toggled.connect(toggle_function)
self.option_2.toggled.connect(self.invert)
if default_choice:
self.option_1.toggle()
else:
self.option_2.toggle()
示例15: add_mask_settings_widget
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QRadioButton [as 别名]
def add_mask_settings_widget(self):
mask_settings_group_box = QtWidgets.QGroupBox("Mask Settings")
mask_settings_layout = QtWidgets.QGridLayout()
mask_settings_layout.addWidget(QtWidgets.QLabel("Mask Opacity"), 0, 0)
mask_settings_layout.addWidget(QtWidgets.QLabel("Mask Smoothness"), 1, 0)
mask_settings_layout.addWidget(self.mask_opacity_sp, 0, 1)
mask_settings_layout.addWidget(self.mask_smoothness_sp, 1, 1)
mask_multi_color_radio = QtWidgets.QRadioButton("Multi Color")
mask_multi_color_radio.setChecked(True)
mask_multi_color_radio.clicked.connect(self.mask_multi_color_radio_checked)
mask_single_color_radio = QtWidgets.QRadioButton("Single Color")
mask_single_color_radio.clicked.connect(self.mask_single_color_radio_checked)
mask_settings_layout.addWidget(mask_multi_color_radio, 2, 0)
mask_settings_layout.addWidget(mask_single_color_radio, 2, 1)
mask_settings_layout.addWidget(self.create_new_separator(), 3, 0, 1, 2)
self.mask_label_cbs = []
c_col, c_row = 0, 4 # c_row must always be (+1) of last row
for i in range(1, 11):
self.mask_label_cbs.append(QtWidgets.QCheckBox("Label {}".format(i)))
mask_settings_layout.addWidget(self.mask_label_cbs[i - 1], c_row, c_col)
c_row = c_row + 1 if c_col == 1 else c_row
c_col = 0 if c_col == 1 else 1
mask_settings_group_box.setLayout(mask_settings_layout)
self.grid.addWidget(mask_settings_group_box, 1, 0, 2, 2)
for i, cb in enumerate(self.mask_label_cbs):
if i < len(self.mask.labels) and self.mask.labels[i].actor:
cb.setChecked(True)
cb.clicked.connect(self.mask_label_checked)
else:
cb.setDisabled(True)