Python Forum
[PyQt] how to deselect radiobutton in pyqt5
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] how to deselect radiobutton in pyqt5
#1
Hello;
I created radiobuttons (radioButton_degre, radioButton_ddm), checkBox(checkbox_confirmed) and a button "Reset" (pushButton_reset) with Qt Designer

when I click on the button, I want all radiobouttons and checkbox to become unselected.
the fonctions display_degre_unit and display_ddm_unit are not defined, to reduce the code for a simplified code

#!/usr/bin/python3
# -*- coding: utf-8 -*-

# PyQT5 :
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *


class MainApp(QMainWindow,FORM_CLASS) :
    def __init__(self,parent=None) :
        super(MainApp,self).__init__(parent)
        QMainWindow.__init__(self)
        self.setupUi(self)
		
		self.pushButton_reset.clicked.connect(self.initialize)
        self.radioButton_degre.toggled.connect(self.display_degre_unit)
        self.radioButton_ddm.toggled.connect(self.display_ddm_unit)

	def initialize(self):

		self.checkbox_confirmed.setCheckState(Qt.Unchecked)
		self.radioButton_degre.setChecked(False)
		self.radioButton_ddm.setChecked(False)
		

def main():
    app=QApplication(sys.argv)
    window=MainApp()
    window.show()
    app.exec_()

if __name__=='__main__' :
    main()
It works for the checkbox but does not work for radiobuttons

thanks for help
Reply


Messages In This Thread
how to deselect radiobutton in pyqt5 - by atlass218 - Oct-22-2019, 12:36 PM
RE: how to deselect radiobutton in pyqt5 - by Denni - Oct-22-2019, 04:04 PM
RE: how to deselect radiobutton in pyqt5 - by Denni - Oct-23-2019, 03:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to dynamically change radiobutton text kenwatts275 2 3,373 Mar-05-2021, 02:25 AM
Last Post: deanhystad
  Python3 tkinter radiobutton problem Nick_tkinter 14 6,080 Feb-15-2021, 11:01 PM
Last Post: Nick_tkinter
  [Tkinter] RadioButton Maryan 2 2,184 Oct-23-2020, 09:36 PM
Last Post: Maryan
  [Tkinter] How to create radiobutton in numpy gui python? luthfidali 2 2,622 May-23-2020, 10:35 AM
Last Post: timo
  Tkinter: increasing numbers and Radiobutton issue PeroPuri 1 2,177 Apr-13-2020, 05:48 PM
Last Post: deanhystad
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 2,836 Apr-06-2019, 11:15 PM
Last Post: ZenWoR
  [Tkinter] Clicking a RadioButton in a for Loop & Getting the Appropriate Return Vicolas 1 5,175 Feb-02-2019, 01:53 AM
Last Post: woooee
  [Tkinter] Radiobutton in Tkinter not Updating Variable from Value Aidan54321 1 7,379 Jun-16-2017, 11:08 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020