37 lines
806 B
Python
37 lines
806 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
最简化的应用程序测试
|
|
"""
|
|
|
|
import sys
|
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QVBoxLayout, QWidget
|
|
|
|
def main():
|
|
app = QApplication(sys.argv)
|
|
|
|
# 创建简单的窗口
|
|
window = QMainWindow()
|
|
window.setWindowTitle("测试窗口")
|
|
window.setGeometry(100, 100, 800, 600)
|
|
|
|
# 创建中心部件
|
|
central_widget = QWidget()
|
|
window.setCentralWidget(central_widget)
|
|
|
|
# 创建布局
|
|
layout = QVBoxLayout(central_widget)
|
|
|
|
# 添加标签
|
|
label = QLabel("如果能看到这个窗口,说明基本环境正常!")
|
|
layout.addWidget(label)
|
|
|
|
# 显示窗口
|
|
window.show()
|
|
|
|
# 运行应用
|
|
sys.exit(app.exec_())
|
|
|
|
if __name__ == '__main__':
|
|
main() |