【问题标题】:PyQt6 Application 'not responding' after closing main window on macos Monterey关闭macos Monterey上的主窗口后PyQt6应用程序“没有响应”
【发布时间】:2022-10-05 22:27:36
【问题描述】:

我是 PyQt6 的新手,遇到了一个使编码非常乏味的问题:当我关闭我正在使用 CMD+Q 或菜单栏处理的应用程序时,窗口关闭但应用程序/python 进程仍在菜单栏并停止响应。我最终不得不每次都强制关闭它。

我通过单击 Spyder 菜单栏中的播放按钮来启动程序。

如何正确设置应用程序以退出?这是我正在使用的代码的相关部分:

from PyQt6.QtWidgets import QApplication, QWidget
import sys

class Window(QWidget):
    def __init__(self):
         super().__init__()
    
app = QApplication(sys.argv)

window = Window()
window.show()
sys.exit(app.exec())

image of the app in the dock

我的设置:Python | 3.10.4,PyQt6 | 6.3.2、macos蒙特雷12.4

  • 你是如何运行程序的?
  • @musicamante 添加了它(不确定您是否收到有关帖子编辑的通知,所以为了安全起见,我也在评论)

标签: python pyqt freeze exit pyqt6


【解决方案1】:

我找到了解决方案/解决方法。通过系统终端运行应用程序(或在 Preferences>Run>Console 中告诉 Spyder 执行此操作)可使程序正确退出,而不必每次都强制退出。

【讨论】:

    猜你喜欢
    • 2013-11-27
    • 1970-01-01
    • 2023-03-03
    • 2012-08-29
    • 2012-04-17
    • 1970-01-01
    • 2011-04-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多