Files
dtm-py-all/UI/reserved/test_window.py

37 lines
879 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
简单的测试窗口用于验证PyQt5环境
"""
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QVBoxLayout, QWidget
class TestWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("测试窗口")
self.setGeometry(100, 100, 400, 300)
# 创建中心部件
central_widget = QWidget()
self.setCentralWidget(central_widget)
# 创建布局
layout = QVBoxLayout(central_widget)
# 添加标签
label = QLabel("如果能看到这个窗口说明PyQt5环境正常")
layout.addWidget(label)
def main():
app = QApplication(sys.argv)
window = TestWindow()
window.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()