-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperfect_build.py
46 lines (36 loc) · 1.3 KB
/
perfect_build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import sys
from PySide6.QtWidgets import QApplication, QDialog, QVBoxLayout, QTextBrowser
from PySide6.QtGui import QIcon
from pathlib import Path
def app_dir():
"""Returns the base application path."""
if hasattr(sys, "frozen"):
# Handles PyInstaller
return Path(sys.executable).parent # 使用pyinstaller打包后的exe目录
return Path(__file__).parent # 没打包前的py目录
class Config:
app_ver = "1.0.0"
app_name = "完美构建"
app_exec = "perfect_build"
app_publisher = "技术有限公司"
app_url = "https://www.example.com"
app_icon = "icon/icon.ico"
app_dir = app_dir()
class MainWindow(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
# self.setWindowFlags(Qt.WindowCloseButtonHint) # 只显示关闭按钮
self.setFixedSize(400, 300)
self.setWindowTitle("HELLO")
layout = QVBoxLayout(self)
purpose = QTextBrowser()
purpose.setText("Perfect Build!\n" * 50)
purpose.setReadOnly(True) # 设置为只读,防止用户编辑文本
layout.addWidget(purpose)
self.setLayout(layout)
if __name__ == "__main__":
app = QApplication([])
window = MainWindow()
window.setWindowIcon(QIcon(Config.app_icon))
window.show()
app.exec()