我正面临pyQT的一个问题。 所以我创建了一个包含QTabWidget的设计器的图形界面。 事情是我想隐藏和显示标签时,我的功能正在运行。我发现了一个解决方案,包括删除所有选项卡并稍后添加它们。 可以说,我只有两个选项卡:在QTabWidget(PyQT)中添加已删除的选项卡
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中创建的选项卡(不删除它们)。 – NicoCati