常用控件

时间:2020-01-31 17:19:40   收藏:0   阅读:54

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_())
后续更新........
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!