效果如下图:

添加状态栏(显示状态信息)

代码:

 1 """
 2 ZetCode PyQt5 tutorial
 3 This program creates a statusbar.
 4 """
 5 import sys
 6 from PyQt5.QtWidgets import QMainWindow, QApplication
 7 # The statusbar is created with the help of the QMainWindow widget.
 8 
 9 
10 class Example(QMainWindow):
11 
12     def __init__(self):
13         super().__init__()
14 
15         self.initUI()
16 
17 
18     def initUI(self):
19 
20         # The showMessage() displays a message on the statusbar.
21         self.statusBar().showMessage('Ready')
22 
23         self.setGeometry(300, 300, 250, 150)
24         self.setWindowTitle('Statusbar')
25         self.show()
26 
27 
28 if __name__ == '__main__':
29 
30     app = QApplication(sys.argv)
31     ex = Example()
32     sys.exit(app.exec_())

 

相关文章:

  • 2021-07-27
  • 2022-12-23
  • 2021-11-09
  • 2021-05-21
  • 2022-12-23
  • 2021-12-04
  • 2021-12-04
  • 2021-09-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
相关资源
相似解决方案