先让本tabWidget对象的currentChanged对象和指向一个程序self.tab_changed,在程序self.tab_changed中改变窗口大小
self.yourTabWidget.currentChanged.connect( self.tab_changed )
def tab_changed(self):
if self.yourTabWidget.currentIndex == 0:
self.setGeometry(x, x, x, x) # size for first tab
elif self.yourTabWidget.currentIndex == 1:
self.setGeometry(x, x, x, x) # size for second tab
网友评论