简体   繁体   中英

How can I add an image (or text) to a pyqt5 QtabWidget with no tabs?

Below is an image of a tab widget without any tabs. When tabs appear I would like the image to disappear.

空标签 - “这里”显示我想要图片的位置

The only code I can provide for this issue (I guess) is

self.tab_widget = QtWidgets.QTabWidget(self.central_widget)

Well there is no native method that enables this. You after you add or remove a tab from the tab_widget you could just swap the tab_widget with another widget when there are no tabs left. And swap it back once you add a tab again. This is obviously not the move elegant solution, but it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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