【发布时间】:2011-11-28 16:01:08
【问题描述】:
我遇到了 pyQT 的问题。 所以我用设计器创建了一个图形界面,包含一个 QTabWidget。 事情是我想在我的功能运行时隐藏和显示选项卡。我找到了一种解决方案,其中包括删除所有选项卡并稍后添加它们。 假设我只有两个标签:
removedTab = self._application.getAlgorithmGUI().getWidget('tabWidget_Verification').widget(1)
self._application.getAlgorithmGUI().getWidget( 'tabWidget_Verification' ).removeTab( 1 )
当我稍后尝试添加这个已删除的选项卡时,我的程序崩溃了。
self._application.getAlgorithmGUI().getWidget( 'tabWidget_Verification' ).addTab(removedTab,QString.fromUtf8("TabRemoved"))
这是我的错误信息:
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
<unknown>: Fatal IO error 11 (Ressource temporairement non disponible) on X server :0.0.
有什么建议吗?
【问题讨论】:
-
其实还不够清楚。为什么要“删除所有选项卡并稍后添加”?为什么不声明所有需要的选项卡并在需要时调用它们并在不再需要它们时将它们从索引中删除?
-
首先我只是想隐藏一些标签并在我的功能的精确时刻显示它们。由于选项卡没有隐藏/显示方法,因此我找到了删除我在 .ui 中创建的选项卡的解决方案(不删除它们)。
标签: python qt pyqt qtabwidget