常用控件

Label控件

# -*- coding:utf-8 -*-
from PyQt5.Qtwidgets import QApplication, QMainWindow, QLabel
from sys
# 导入第三方库
if __name__ == "__main__":
   app = QApplication(sys.argv)
   win_root = QMainWindow()
   win_root.resize(600, 600)# 重置窗口大小
   win_root.setWindowTitle("添加Label的例子")
   # 为窗口添加Label控件
   """start"""
   Label = QLabel()
   Label.setText("这是一个标签")# 为标签设置内容
   Label.setParent(win_root)# 将Label添加到win_root
   Label.show()# 显示Label
   """end"""
   win_root.show()
   sys.exit(app.exec_())
后续更新……..
版权声明:本文为MindBin原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/MindBin/p/12245732.html