Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在PySimpleGUIQt中使用单选按钮动态隐藏GUI元素_Python_User Interface_Visible_Invisible_Pysimplegui - Fatal编程技术网

Python 在PySimpleGUIQt中使用单选按钮动态隐藏GUI元素

Python 在PySimpleGUIQt中使用单选按钮动态隐藏GUI元素,python,user-interface,visible,invisible,pysimplegui,Python,User Interface,Visible,Invisible,Pysimplegui,我使用以下方法来隐藏GUI元素,效果非常好: import PySimpleGUIQt as sg layout = [ [sg.Checkbox('Module Selection', default = False, change_submits= True, key = '_checkbox1_', size=(15,1)), sg.Text('Module(.xlsx)', size = (15,0.5), auto_size_t

我使用以下方法来隐藏GUI元素,效果非常好:

import PySimpleGUIQt as sg

layout = [          
         [sg.Checkbox('Module Selection', default = False, change_submits= True, key = '_checkbox1_', size=(15,1)),
         sg.Text('Module(.xlsx)', size = (15,0.5), auto_size_text = True, justification = 'right', key = '_moduletext_')]
         ]


window = sg.Window('A2L', layout, icon = u"icon\\index.ico", auto_size_buttons = False).Finalize()  
window.Element('_moduletext_').Update(visible = False) #makes the element invisible
values_dict={}


while True:  # Event Loop            
    button, values_dict = window.Read()

    if values_dict['_checkbox1_']:
        window.Element('_moduletext_').Update(visible = True)
这里的问题是,如果我用单选按钮替换复选框,那么相同的代码不会动态隐藏gui元素。下面是带有单选按钮的代码:

import PySimpleGUIQt as sg

layout = [          
             [sg.Radio('Module Selection','RADIO' default = False, enable_events = True, key = '_radio1_', size=(15,1)),
             sg.Text('Module(.xlsx)', size = (15,0.5), auto_size_text = True, justification = 'right', key = '_moduletext_')]
             ]


window = sg.Window('A2L', layout, icon = u"icon\\index.ico", auto_size_buttons = False).Finalize()  
window.Element('_moduletext_').Update(visible = False) #makes the element invisible
values_dict={}


while True:  # Event Loop            
        button, values_dict = window.Read()

        if values_dict['_radio1_']:
            window.Element('_moduletext_').Update(visible = True)

如何在pysimpleGUIqt中使用单选按钮隐藏元素?

在pysimpleGUIqt中尚未实现启用单选按钮事件。刚刚完成了它的代码,并针对它尝试了您的代码


您需要在上下载文件并将其放在应用程序的文件夹中。

单选按钮通常有多个。不确定单个收音机的性能。一个复选框就可以了,但不是单选按钮。我认为您遇到了一个bug,或者单选按钮enable\u事件没有实现。我以为是,但可能不是在Qt上。我会把它放在优先位置,看看代码。@MikeyB我刚才在《伟大》中引用了你的话。。。。这些都需要在GitHub上提问。这个页面上有你在这里制作和链接的另一篇文章的答案。邮件似乎无法通过。感谢您更新代码。我使用您的代码时出错,我在这里解释过:我不建议在这里发布此类问题。将它们发布在项目的GitHub站点上。您将获得更快的支持,并且可以更轻松地发布代码和图像。