【问题标题】:How do I create a RadioButton in my GUI in python?如何在 python 的 GUI 中创建 RadioButton?
【发布时间】:2015-09-07 00:25:25
【问题描述】:

我一直在尝试创建一个简单的 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)

【问题讨论】:

    标签: python user-interface variables radio-button


    【解决方案1】:

    使用SetValue(self, False) 将其设置为未选中。 你可以阅读更多关于它here

    【讨论】:

      猜你喜欢
      • 2011-06-25
      • 2011-07-23
      • 1970-01-01
      • 1970-01-01
      • 2017-02-03
      • 2017-08-04
      • 2015-09-17
      • 2011-07-22
      • 2015-08-11
      相关资源
      最近更新 更多