今天是Pyside6的第五篇内容。一起来看单选按钮。
QRadioButton。
class QRadioButton(QAbstractButton):
"""
QRadioButton(self, parent: Optional[PySide6.QtWidgets.QWidget] = None) -> None
QRadioButton(self, text: str, parent: Optional[PySide6.QtWidgets.QWidget] = None) -> None
"""
❝根据源码提示,很明显了,跟前面几个类似
❞
import sys
from PySide6.QtWidgets import QApplication, QWidget, QRadioButton
class Radio(QWidget):
def __init__(self):
super(Radio, self).__init__()
self.initUI()
def initUI(self):
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('QRadioButton')
btn_radio_man = QRadioButton("男", self)
btn_radio_man.move(20, 20)
btn_radio_woman = QRadioButton(self)
btn_radi