View Full Version : Show or Hide GroupBox on same button click

11th September 2019, 21:33
Hi user!
i have a question.

i am developing a software. For my question i have uploaded a picture. I want that when i click on the setup button the group box should be hidden and when i press setup button again then group box should be visible and so on, the same like Qt widget box.

i am Writing my code like this:

def show_hide_box(self):
visible = True
if self.pushButton.clicked:
if visible == True:

when i click the setup button the group box become hidden button when i click it the button again its does't work.

12th September 2019, 23:14
"self.pushButton.clicked" is a signal, not a status variable. This code probably doesn't even run.

If you want to be notified when the user clicks one of the buttons, then you need to define a slot and connect it to the pushbutton's clicked() signal. In that slot, you check the value of your "visible" variable and show or hide the group box as appropriate. You don't actually need this variable - you can simply check to see if the group box is visible (groupBox_2.isVisible()).