Add "Run as Script" program entry

增加以脚本形式启动主程序的入口方式;
This commit is contained in:
muzing 2023-12-08 23:08:14 +08:00
parent 68fad69821
commit b63134e895
4 changed files with 24 additions and 1 deletions

View File

@ -48,6 +48,12 @@ pip install py2exe-gui
Run:
```shell
py2exe-gui
```
You can run py2exe-gui as a package if running it as a script doesn't work:
```shell
python -m py2exe_gui # `_`, not `-`
```

View File

@ -48,6 +48,12 @@ pip install py2exe-gui
运行
```shell
py2exe-gui
```
如果以脚本形式运行失败,还可以尝试作为 Python 包运行:
```shell
python -m py2exe_gui # 注意连字符为_
```

View File

@ -12,6 +12,9 @@ exclude = ["src/py2exe_gui/Resources/Icons", "src/py2exe_gui/Resources/Texts"]
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/muziing/Py2exe-GUI/issues"
[tool.poetry.scripts]
py2exe-gui = 'py2exe_gui.__main__:main'
#[[tool.poetry.source]]
#name = "tsinghua_mirror"
#url = "https://pypi.tuna.tsinghua.edu.cn/simple/"

View File

@ -57,8 +57,16 @@ class MainApp(MainWindow):
super().closeEvent(event)
if __name__ == "__main__":
def main():
"""
应用程序主入口函数
"""
app = QApplication(sys.argv)
window = MainApp()
window.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()