简体   繁体   English

如何禁用 pyqt5 中选项卡的所有内容

[英]How to disable all the contents of tab in pyqt5

I have created tabwidget and added multiple tabs in it.我创建了 tabwidget 并在其中添加了多个选项卡。

在此处输入图像描述

To disable elements in a tag, I can use要禁用标签中的元素,我可以使用

senEnabled(False)

method on each items of tab.选项卡的每个项目上的方法。

Is there any easy or direct way which can disable all the elements in whole tab in one go?是否有任何简单或直接的方法可以在一个 go 中禁用整个选项卡中的所有元素?

If the parent widget is disabled then the child widgets will also be disabled, so in your case only the widget page corresponding to the tab will be disabled:如果父小部件被禁用,那么子小部件也将被禁用,因此在您的情况下,只有与选项卡对应的小部件页面将被禁用:

page = tab_widget.widget(index_of_tab)
if page is not None:
    page.senEnabled(False)

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

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