【发布时间】:2020-12-01 01:49:53
【问题描述】:
所以我现在要做的是,如果我单击其中一个单选按钮,则有关该方法的一些信息应自动显示在 GUI 中,但我似乎无法正确处理。 我想也许我可以通过使用 if 语句来完成它,但没有任何反应。
import PySimpleGUI as sg
# List for Radiobuttons
radio_choices = ["Method 1", "Method 2", "Method 3", "Method 4"]
layout = [[sg.Text("Choose Method")],
*[[sg.Radio(text, 1), ] for text in radio_choices],
[sg.Button("Start"), sg.Button("Stop"), sg.Button("Exit")]
]
window = sg.Window("Choose Method", layout, size=(350, 350))
while True:
event, values = window.Read()
if event == "Exit" or event == sg.WIN_CLOSED:
break
if event == radio_choices[0]:
sg.Text("Method 1 description")
window.close()
【问题讨论】:
标签: python user-interface radio-button pysimplegui