def __init__(self): super(MyWindow, self).__init__() self.initGUI("QRadioButton") layout = QGridLayout() self.setLayout(layout) # RadioButton 设置,默认的所有的都是出于同一个按钮组 rdbtn = QRadioButton("Brazil") rdbtn.setChecked(True) # NOTE: 可以绑定用户定义的数据 rdbtn.country = "Brazil" rdbtn.toggled.connect(self.on_radio_button_toggled) layout.addWidget(rdbtn, 0, 0) rdbtn = QRadioButton("Argentian") rdbtn.country = "Argentian" # 连接信号与槽函数 rdbtn.toggled.connect(self.on_radio_button_toggled) layout.addWidget(rdbtn, 0, 1) rdbtn = QRadioButton("Ecuador") rdbtn.country = "Ecuador" rdbtn.toggled.connect(self.on_radio_button_toggled) layout.addWidget(rdbtn, 0, 2)
def __init__(self): super(MainWindow, self).__init__() uipath = os.path.normpath("Resources/depotdownloadergui.ui") # uncomment line below if compiling # uipath = os.path.join(os.path.dirname(sys.executable), 'Resources/depotdownloadergui.ui') uic.loadUi(uipath, self) self.outputedit = self.findChild(QtWidgets.QTextEdit, 'outputedit') self.output = self.outputedit self.runButton = self.findChild(QtWidgets.QPushButton, 'runpushbutton') self.runButton.clicked.connect(self.callProgram) layout = self.findChild(QtWidgets.QHBoxLayout, 'horizontalLayout') self.buttonopenmanid = self.findChild(QtWidgets.QPushButton, 'openmanidpushbutton') self.buttonopenmanid.clicked.connect(self.openmanidpushbuttonPressed) self.buttonbrsdl = self.findChild(QtWidgets.QPushButton, 'brsdlpushbutton') self.buttonbrsdl.clicked.connect(self.brsdlpushbuttonPressed) self.buttonformat = self.findChild(QtWidgets.QPushButton, 'formatpushbutton') self.buttonformat.clicked.connect(self.formatpushbuttonPressed) self.cb = self.findChild(QtWidgets.QPushButton, 'cb') self.cb.clicked.connect(self.cbPressed) self.killbutton = self.findChild(QtWidgets.QPushButton, 'candown') self.manpathedit = self.findChild(QtWidgets.QPlainTextEdit, 'manedit') self.manpathedit.insertPlainText(fileName1) self.progress = self.findChild(QtWidgets.QLabel, 'loader') ldico = os.path.normpath("Resources/loading_icon.gif") self.movie = QMovie(ldico) self.progress.setMovie(self.movie) radiobutton = QRadioButton("Auto") radiobutton.setChecked(True) radiobutton.country = "Auto" radiobutton.toggled.connect(self.onClicked) layout.addWidget(radiobutton) radiobutton = QRadioButton("Windows") radiobutton.country = "Windows" radiobutton.toggled.connect(self.onClicked) layout.addWidget(radiobutton) radiobutton = QRadioButton("MacOS") radiobutton.country = "MacOS" radiobutton.toggled.connect(self.onClicked) layout.addWidget(radiobutton) radiobutton = QRadioButton("Linux") radiobutton.country = "Linux" radiobutton.toggled.connect(self.onClicked) layout.addWidget(radiobutton) self.rbv = "Auto" self.show()
radiobutton3 = QRadioButton("Green") radiobutton3.color = "Green" radiobutton3.toggled.connect(lambda: radioCheck(radiobutton3)) horizonatLayout = QHBoxLayout() horizonatLayout.addWidget(radiobutton1) horizonatLayout.addWidget(radiobutton2) horizonatLayout.addWidget(radiobutton3) groupBox1 = QGroupBox() groupBox1.setLayout(horizonatLayout) vertlical_Layout.addWidget(groupBox1) #radio Button Groups 2 radiobutton4 = QRadioButton("India") radiobutton4.country = "India" radiobutton4.toggled.connect(lambda: radioCheck2(radiobutton4)) radiobutton5 = QRadioButton("Africa") radiobutton5.country = "Africa" radiobutton5.toggled.connect(lambda: radioCheck2(radiobutton5)) radiobutton6 = QRadioButton("Australia") radiobutton6.country = "Australia" radiobutton6.toggled.connect(lambda: radioCheck2(radiobutton6)) horizonatLayout2 = QHBoxLayout() horizonatLayout2.addWidget(radiobutton4) horizonatLayout2.addWidget(radiobutton5) horizonatLayout2.addWidget(radiobutton6) groupBox2 = QGroupBox()