title: How to hide a tab in QTabWidget and show it when a button is pressed
body: <p>I have already created the tabs in QtabWidget. My main purpose is to hide tabs and show it when a button is pressed. I don't want to remove and add tabs every time. I want to hide it and show when required. </p>
  
  <p>I have tried to do this:</p>
  
  <pre><code>self.tab.hide()
  </code></pre>
  
  <p>But this doesn't work.
  Here is the code for current GUI:</p>
  
  <pre><code>    MainWindow.setObjectName(_fromUtf8("MainWindow"))
      MainWindow.resize(680, 425)
      self.centralwidget = QtGui.QWidget(MainWindow)
      self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
      self.verticalLayout_3 = QtGui.QVBoxLayout(self.centralwidget)
      self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
      self.tabWidget = QtGui.QTabWidget(self.centralwidget)
      self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
      self.tab = QtGui.QWidget()
      self.tab.setObjectName(_fromUtf8("tab"))
      self.verticalLayout_4 = QtGui.QVBoxLayout(self.tab)
      self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
      self.pushButton_3 = QtGui.QPushButton(self.tab)
      self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
      self.verticalLayout_4.addWidget(self.pushButton_3)
      self.tabWidget.addTab(self.tab, _fromUtf8(""))
      self.tab_2 = QtGui.QWidget()
      self.tab_2.setObjectName(_fromUtf8("tab_2"))
      self.verticalLayout_5 = QtGui.QVBoxLayout(self.tab_2)
      self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
      self.treeWidget = QtGui.QTreeWidget(self.tab_2)
      self.treeWidget.setObjectName(_fromUtf8("treeWidget"))
      self.verticalLayout_5.addWidget(self.treeWidget)
      self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
      self.verticalLayout_3.addWidget(self.tabWidget)
      MainWindow.setCentralWidget(self.centralwidget)
      self.menubar = QtGui.QMenuBar(MainWindow)
      self.menubar.setGeometry(QtCore.QRect(0, 0, 680, 21))
      self.menubar.setObjectName(_fromUtf8("menubar"))
      MainWindow.setMenuBar(self.menubar)
      self.statusbar = QtGui.QStatusBar(MainWindow)
      self.statusbar.setObjectName(_fromUtf8("statusbar"))
      MainWindow.setStatusBar(self.statusbar)
      self.dockWidget = QtGui.QDockWidget(MainWindow)
      self.dockWidget.setObjectName(_fromUtf8("dockWidget"))
      self.dockWidgetContents = QtGui.QWidget()
      self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
      self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents)
      self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
      self.pushButton = QtGui.QPushButton(self.dockWidgetContents)
      self.pushButton.setObjectName(_fromUtf8("pushButton"))
      self.verticalLayout.addWidget(self.pushButton)
      self.dockWidget.setWidget(self.dockWidgetContents)
      MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget)
      self.dockWidget_2 = QtGui.QDockWidget(MainWindow)
      self.dockWidget_2.setObjectName(_fromUtf8("dockWidget_2"))
      self.dockWidgetContents_2 = QtGui.QWidget()
      self.dockWidgetContents_2.setObjectName(_fromUtf8("dockWidgetContents_2"))
      self.verticalLayout_2 = QtGui.QVBoxLayout(self.dockWidgetContents_2)
      self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
      self.pushButton_2 = QtGui.QPushButton(self.dockWidgetContents_2)
      self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
      self.verticalLayout_2.addWidget(self.pushButton_2)
      self.lineEdit = QtGui.QLineEdit(self.dockWidgetContents_2)
      self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
      self.verticalLayout_2.addWidget(self.lineEdit)
      self.dockWidget_2.setWidget(self.dockWidgetContents_2)
      MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget_2)
  </code></pre>