.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\itom\ui\demo_windowExamples.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_itom_ui_demo_windowExamples.py: Window ========= Window is a stand-alone window. The window is only hidden if the user closes it. Call show again to re-show it. It is only deleted, if the window variable is deleted. .. GENERATED FROM PYTHON SOURCE LINES 7-15 .. code-block:: Python from itom import ui window = ui("mainWindow.ui", ui.TYPEWINDOW) window.show() .. GENERATED FROM PYTHON SOURCE LINES 17-19 Window_destroy is a stand-alone window, that is deleted if the user closes it, not only hidden""" .. GENERATED FROM PYTHON SOURCE LINES 19-36 .. code-block:: Python def window_destroyed(): print("window_destroy destroyed") window_destroy = ui("mainWindow.ui", ui.TYPEWINDOW, deleteOnClose=True) # deleteOnClose can also be set or unset using setAttribute print("state of deleteOnClose flag:", window_destroy.getAttribute(55)) window_destroy.setAttribute(55, True) window_destroy["windowTitle"] = ( "Self-destroyable main window" # change title of main window ) window_destroy.connect("destroyed()", window_destroyed) window_destroy.show() .. rst-class:: sphx-glr-script-out .. code-block:: none state of deleteOnClose flag: True .. GENERATED FROM PYTHON SOURCE LINES 37-38 Window_no_child is a stand-alone window that is no child of the main window with own symbol in the task bar .. GENERATED FROM PYTHON SOURCE LINES 38-44 .. code-block:: Python window_no_child = ui("mainWindow.ui", ui.TYPEWINDOW, childOfMainWindow=False) window_no_child["windowTitle"] = ( "Stand-alone main window" # change title of main window ) window_no_child.show() .. GENERATED FROM PYTHON SOURCE LINES 45-46 Widget_window is a stand-alone window obtained from a widget that was created in QtDesigner. .. GENERATED FROM PYTHON SOURCE LINES 46-49 .. code-block:: Python widget_window = ui("widget.ui", ui.TYPEWINDOW) widget_window.show() .. GENERATED FROM PYTHON SOURCE LINES 50-51 Configure a window to not have a maximize button and to always stay on top. .. GENERATED FROM PYTHON SOURCE LINES 51-60 .. code-block:: Python window_on_top = ui("mainWindow.ui", ui.TYPEWINDOW) window_on_top["windowTitle"] = "On-top window" # change title of main window # 0x00040000 is the flag Qt::WindowStaysOnTopHint and needs to be added if not yet done (or) # 0x00008000 is the flag Qt::WindowMaximizeButtonHint and needs to be removed if not yet done (xor) window_on_top.setWindowFlags((window_on_top.getWindowFlags() | 0x00040000) ^ 0x00008000) # it is also possible to disable the close button by xor-ing Qt::WindowCloseButtonHint (0x08000000) window_on_top.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.212 seconds) .. _sphx_glr_download_11_demos_itom_ui_demo_windowExamples.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_windowExamples.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_windowExamples.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_windowExamples.zip `