30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
#!D:\Python311\python.exe
|
||
# -*- coding: utf-8 -*-
|
||
# @Time : 2024/2/26 13:02
|
||
# @Author : DC_DC
|
||
"""# 打印版本信息
|
||
from PyQt6.QtCore import PYQT_VERSION_STR, QT_VERSION_STR
|
||
print(QT_VERSION_STR)
|
||
print(PYQT_VERSION_STR)"""
|
||
|
||
import sys # 处理python解释器和系统的交互
|
||
from PyQt6.QtWidgets import QApplication, QMainWindow, QLabel
|
||
from PyQt6.QtGui import QIcon # 设置窗口的图标
|
||
|
||
|
||
def main():
|
||
app = QApplication(sys.argv) # 创建一个QApplication对象,用于管理GUI应用程序的控制流和主事件循环
|
||
window = QMainWindow() # 创建一个QMainWindow对象,这是程序的主窗口
|
||
window.setGeometry(500, 500, 300, 200) # 设置窗口的集合属性,即窗口在屏幕上的位置大小
|
||
window.setWindowTitle("DC_DC") # 设置窗口标题
|
||
window.setWindowIcon(QIcon('Photos/img.png')) # 设置窗口图标
|
||
QLabel("Hello, World!", window) # 创建一个QLabel对象,并将其添加到主窗口中
|
||
window.show() # 显示主窗口
|
||
sys.exit(app.exec()) # 调用QApplication对象的exec()方法,进入GUI应用程序的主事件循环,sys.exit()则确保程序在退出事件循环侯正确地退出,并返回一个退出码0
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|
||
|
||
pass
|