【发布时间】:2019-06-20 07:58:14
【问题描述】:
PyQt 中的 MessageBox 不会访问父窗口...我尝试实现自定义 messageBox。但没有什么对我有用。
我尝试使用 QWidget,但使用 Qwidget,小部件被放置在 mainWindow 本身,如下图所示
然后我实现了对话框,它工作正常,但问题是当对话框打开时我们也可以访问主窗口。我希望它就像打开对话框时无法访问 mainWindow。
class MainClass(QtGui.QDialog):
def __init__(self, parent=None):
super(MainClass, self).__init__(parent)
self.setParent(parent)
#widgets added below
...
有人可以帮忙吗?
【问题讨论】:
-
使用
exec_()而不是show()打开它...