.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\itom\ui_dynamicLayout\demo_hboxlayout.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_dynamicLayout_demo_hboxlayout.py: Horizontal Box Layout ======================== .. GENERATED FROM PYTHON SOURCE LINES 5-45 .. rst-class:: sphx-glr-script-out .. code-block:: none 0.04577326774597168 0.02163410186767578 0.02163410186767578 | .. code-block:: Python from itom import ui from itom import uiItem import time t0 = time.time() gui: ui = ui("layoutExample.ui", type=ui.TYPEWINDOW) num = 100 t = time.time() for i in range(num): hlayout: uiItem = gui.horLayout # access the layout item print(time.time() - t) t = time.time() for i in range(num): hlayout = gui.getChild("horLayout") print(time.time() - t) # remove the 2nd widget at index position 1 hlayout.call("removeItemAt", 1) # add a new radio button at the end className: str = "QRadioButton" objName: str = "newRadioButton" radioBtn: uiItem = hlayout.call("addItem", className, objName) radioBtn["text"] = "new option" radioBtn["checked"] = True # insert a spin box at index position 1 idx: int = 1 # insert at this position className: str = "QSpinBox" objName: str = "mySpinBox" spinBox: uiItem = hlayout.call("insertItem", idx, className, objName) spinBox["value"] = 7 print(time.time() - t) gui.show() # show the user interface .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.096 seconds) .. _sphx_glr_download_11_demos_itom_ui_dynamicLayout_demo_hboxlayout.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_hboxlayout.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_hboxlayout.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_hboxlayout.zip `