1、代码1:
(1)进度条等显示在主窗口状态栏的右端,代码如下:
from PyQt5.QtWidgets import QMainWindow, QProgressBar, QApplication, QLabel
import sys
class SampleBar(QMainWindow):
"""Main Application"""
def __init__(self, parent = None):
print('Starting the main Application')
super(SampleBar, self).__init__(parent)
self.initUI()
def initUI(self):
# Pre Params:
self.setMinimumSize(800, 600)
# File Menus & Status Bar:
self.statusBar().showMessage('准备中...')
self.progressBar = QProgressBar()
self.label = QLabel()
self.label2 = QLabel()
self.label.setText("正在计算: ")
self.label2.setText("正在计算: ")
self.statusBar().addPermanentWidget(self.label)
self.statusBar().addPermanentWidget(self.label2)
self.statusBar().addPermanentWidget(self.progressBar)
# self.statusBar().addWidget(self.progressBar)
# This is

本文介绍了如何在Python3.x使用PyQT5库在主窗口的状态栏中,分别展示进度条在右端和左端的方法。通过给出的代码示例,详细展示了两种不同位置的进度条实现,并附有对应的界面截图以供参考。
最低0.47元/天 解锁文章
346

被折叠的 条评论
为什么被折叠?



