Tag: tabs
wx python
While we did not heavily use object orientation for the wxPython series yet for simplicity reasons, we cannot go around it. In this tutorial you will learn how to create a tab interface with wxPython.
Related course: Creating GUI Applications with wxPython
The class Mainframe creates the frame as we did in the previous examples. The other classes are the contents of the tabs. We create a panel and notebook (tab holder) in the main frame. Then we create tab objects :
tab1 = TabOne(nb) |
which we attach to the tab holder using:
nb.AddPage(tab1, "Tab 1") |
Full code:
import wx |
Output:

Related course: Creating GUI Applications with wxPython
pyqt tabs
Tabs are very useful in graphical applications. They appear in webbrowsers, text editors and any other apps. To create a tabbed window, you need to call the QTabWidget() function. Every tab is a QWidget() which you have seen before. You can connect the QWidgets with the QTabWidget with the function:
tabs.addTab(tab1,"Tab 1") |
where the first parameter is the tab object and the second the name that appears on the screen. We added some buttons to the first tab (QWidget).
Related course:
Example code:
from PyQt4 import QtGui |
Result:

Download PyQT Code (Bulk Collection)