繁体   English   中英

如何在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)将其设置为未选中。 您可以在这里了解更多信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM