使一个窗口出现在另一个窗口的顶部,阻止对其他窗口的访问,直到单击按钮 [英] Make a window appear on top of another, block access to other windows until button clicked
问题描述
Python 2.7,PyQt4.8.5
Python 2.7, PyQt4.8.5
我想要一个主应用程序窗口,然后是第二个弹出窗口来显示 com 端口设置.此窗口应始终位于父窗口的顶部,直到单击确定或取消按钮;关闭子窗口.(有点像必需的答案,即在您从子窗口中选择设置之前无法处理)
I want to have a main app window and then a second pop up window to display com port settings. This window should always be on top of the parent window until either the ok or the cancel button is clicked; closing the child window. (sort of like a required answer i.e. cant process until you choose the settings from the child window)
是否有 Python Qt 命令来执行此操作?
Is there a Python Qt command to do this?
抱歉,如果之前有人问过/回答过这个问题,我的搜索没有返回任何有用的信息.
Apologies if this has been asked/answered before, my search returned nothing useful.
推荐答案
你想要一个 模态对话框.例如:
You want a modal dialog. For example:
dialog = QInputDialog()
dialog.exec_()
您可以实现自己的对话框小部件(通过子类化 QDialog
)或使用几个可用的其中之一.
You can either implement your own dialog widget (by subclassing QDialog
) or use one of the several available.
这篇关于使一个窗口出现在另一个窗口的顶部,阻止对其他窗口的访问,直到单击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!