Jan-15-2023, 04:11 PM
Hello, as Im now to Python any help is appreciated
My goal is to determine if a radio button has been selected, to help troubleshoot I have created a short if statement to print out the results on weather it has or has not.
I have viewed this forum for other similar questions but haven't seem to quite get there
I have posted a snippet of the relevant code.
My question is is there a way to determine if a radio button has been selected and how would I incorporate it into the following if statement.
thanks
My goal is to determine if a radio button has been selected, to help troubleshoot I have created a short if statement to print out the results on weather it has or has not.
I have viewed this forum for other similar questions but haven't seem to quite get there
I have posted a snippet of the relevant code.
My question is is there a way to determine if a radio button has been selected and how would I incorporate it into the following if statement.
thanks
#Radio Buttons Menu options #Button to enter player name self.button_selected = IntVar() self.button_selected.set(0) #Radio button to add player name self.menu_button1 = Radiobutton(self, text = "Add player names", variable = self.button_selected, value = 0) self.menu_button1.grid(row = 3, column = 0, sticky="W") #Radio button to view all scores self.menu_button2 = Radiobutton(self, text = "View all player scores", variable = self.button_selected, value = 1) self.menu_button2.grid(row = 4, column = 0, sticky="W") #if statment or troubleshooting if Radiobutton.value == ??????? #not sure where to go here???? print("radio button IS selected") else: print("radio button IS NOT selected")