这是使用PyQT5作为UI的首次提交,将后端和UI合并到1个工程中,统一使用了Python,没有使用JS和HTML
This commit is contained in:
37
UI/reserved/simple_test.py
Normal file
37
UI/reserved/simple_test.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/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()
|
||||
Reference in New Issue
Block a user