...

/

QDockWidget, QStatusBar, and QToolBar

QDockWidget, QStatusBar, and QToolBar

Understand how our GUI applications use QDockWidget, QStatusBar, and QToolBar widgets.

QDockWidget and QStatusBar

Toolbars, status bars, and dock widgets can be added to GUIs using framework software. When the mouse pointer is over the "Exit" icon in the toolbar, the status bar at the bottom displays the text "Quit program".

We start by importing the modules which will be required for the application.

Press + to interact
import sys
from PyQt6.QtWidgets import (QApplication, QMainWindow, QStatusBar, QTextEdit, QToolBar, QDockWidget)
from PyQt6.QtCore import Qt, QSize
from PyQt6.QtGui import QIcon, QAction

Then we initialize the window and display its contents on the screen, and we also set a new central widget for our main window.

Press + to interact
class BasicMenu(QMainWindow):
def __init__(self):
super().__init__()
self.initializeUI()
def initializeUI(self):
self.setGeometry(100, 100, 350, 350) # x, y, width, height
self.setWindowTitle('Basic Menu Example 2')
self.setCentralWidget(QTextEdit())
self.createMenu()
self.createToolBar()
self.createDockWidget()
self.show()

After that, we create ...