.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\itom\ui\demoDialogExamples.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_itom_ui_demoDialogExamples.py: Dialog ========= The dialog is created from a QDialog, designed in QtDesigner. The dialog already has OK and Cancel buttons whose clicked signal is connected with the accept and reject slot of the dialog. If you show the dialog in a modal way, you can then obtain the result (if OK or Cancel has been clicked). Use deleteOnClose=true such in order to close the dialog once the user pressed OK or Cancel. .. GENERATED FROM PYTHON SOURCE LINES 11-18 .. code-block:: default from itom import ui dialog = ui("dialog.ui", ui.TYPEDIALOG) print("Result of the dialog:", dialog.show(1)) # show a modal dialog .. GENERATED FROM PYTHON SOURCE LINES 20-23 Dialog created from widget. In this case, no terminating buttons are visible. The behaviour is then similar to a main window without the minimize or maximize buttons .. GENERATED FROM PYTHON SOURCE LINES 23-26 .. code-block:: default dialog_widget = ui("widget.ui", ui.TYPEDIALOG) dialog_widget.show() .. GENERATED FROM PYTHON SOURCE LINES 27-31 If the dialog should be created from a widget, you can automatically let itom place buttons at the right or bottom side of the widget. Define the title and the role of each button using a dictionary. The roles are taken from Qt (``QDialogButtonBox::ButtonRole``) .. GENERATED FROM PYTHON SOURCE LINES 31-38 .. code-block:: default dialog_widget_buttonbar = ui( "widget.ui", ui.TYPEDIALOG, ui.BUTTONBAR_VERTICAL, {"AcceptRole": "OK", "RejectRole": "Cancel"}, ) print("Result of the dialog:", dialog_widget_buttonbar.show(1)) .. _sphx_glr_download_11_demos_itom_ui_demoDialogExamples.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demoDialogExamples.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demoDialogExamples.ipynb `