pyqt tabs
Python hosting: Host, run, and code Python in the cloud!
Tabs are a prominent feature in various graphical applications. These tabbed interfaces can be seen in web browsers, text editors, and numerous other software applications. In order to craft a tabbed interface in your application, PyQt offers the QTabWidget()
method. Each individual tab is represented as a QWidget()
. Associating these QWidgets to the QTabWidget is achieved through the following method:
tabs.addTab(tab1,"Tab 1") |
Here, the initial parameter is the tab’s object, while the second denotes the label that gets displayed to the user. In our example, we’ve embellished the first tab (QWidget) with a few buttons for demonstration.
Related course:
Detailed Example:
This sample code leverages the qtabwidget to demonstrate the tab display mechanism in PyQt:
from PyQt4 import QtGui |
Outcome:
Interested in more such PyQt samples? Download the Bulk Collection of PyQT Code.
Leave a Reply:
Okay, I tried the sample...I'm officially impressed...
Python as the vehicle of choice for desktop programs...
Thanks :)
Awesome! There will be more tutorials soon, I may write some this evening.