问题
Python 2.7, PyQt4.8.5
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)
Is there a Python Qt command to do this?
Apologies if this has been asked/answered before, my search returned nothing useful.
回答1:
You want a modal dialog. For example:
dialog = QInputDialog()
dialog.exec_()
You can either implement your own dialog widget (by subclassing QDialog
) or use one of the several available.
来源:https://stackoverflow.com/questions/8622090/make-a-window-appear-on-top-of-another-block-access-to-other-windows-until-butt