如何在 python 中的 GUI 中创建 RadioButton?
How do I create a RadioButton in my GUI in python?
我一直在尝试创建一个简单的 RadioButton,但问题是两个按钮都已显示为已单击(当 GUI 启动时,它们内部有黑色圆圈)。我该如何解决这个问题?
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)
使用SetValue(self, False)
将其设置为未选中。
您可以阅读更多相关信息 here
我一直在尝试创建一个简单的 RadioButton,但问题是两个按钮都已显示为已单击(当 GUI 启动时,它们内部有黑色圆圈)。我该如何解决这个问题?
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)
使用SetValue(self, False)
将其设置为未选中。
您可以阅读更多相关信息 here