Shan
Shan

Reputation: 381

How do I create a RadioButton in my GUI in python?

I've been trying to create a simple RadioButton, but the issue is that both buttons already show up as clicked (they have the black circle inside of them when the GUI starts up). How would I fix this?

this.myVar = StringVar()
this.button1 = Radiobutton(this.root,text = "Small Boxes First",variable = this.myVar)
this.button1.grid(row = 2,column = 5)
this.button2 = Radiobutton(this.root,text = "Large Boxes First",variable = this.myVar)
this.button2.grid(row = 3,column = 5)

Upvotes: 1

Views: 79

Answers (1)

John
John

Reputation: 1852

Use SetValue(self, False) to set it to unchecked. You can read more about it here

Upvotes: 1

Related Questions