Make a window appear on top of another, block access to other windows until button clicked

StackOverflow https://stackoverflow.com/questions/8622090

  •  28-03-2021
  •  | 
  •  

Pregunta

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.

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top