.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\itom\ui\demo_splitter.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_splitter.py: Splitter =========== This demo shows how to manipulate a splitter, set as layout in QtDesigner. .. hint:: This demo uses specially wrapped methods of QSplitter. For more information see section ``Calling slots`` in https://itom-project.github.io/latest/docs/06_extended_gui/qtdesigner.html) These methods are indicated by #-> special method call .. GENERATED FROM PYTHON SOURCE LINES 12-48 .. rst-class:: sphx-glr-script-out .. code-block:: none Top section. Collapsible: False Bottom section. Collapsible: True | .. code-block:: Python from itomUi import ( ItomUi, ) # import the base class ItomUi from the module itomUi in the itom-packages subfolder from itom import ui class SplitterDemo(ItomUi): # ListWidgetDemo is inherited from ItomUi def __init__(self): # constructor # call constructor of ItomUi like it would be the constructor of the class itom.ui: ItomUi.__init__(self, "splitterDemo.ui", ui.TYPEWINDOW) self.gui.splitter.call("setStretchFactor", 0, 3) # -> special method call self.gui.splitter.call("setStretchFactor", 1, 1) # -> special method call self.gui.splitter.call("setCollapsible", 0, False) # -> special method call self.gui.splitter.call("setCollapsible", 1, True) # -> special method call print( "Top section. Collapsible:", self.gui.splitter.call("isCollapsible", 0), ) # -> special method call print( "Bottom section. Collapsible:", self.gui.splitter.call("isCollapsible", 1), ) # -> special method call # it is also possible to set the sizes of the sections using # self.gui.splitter.call("setSizes", (200, 300)) #-> special method call # or read it # print(self.gui.splitter.call("sizes")) #-> special method call # create a first instance of ListWidgetDemo and the gui win1 = SplitterDemo() win1.gui.show() # show the gui .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.059 seconds) .. _sphx_glr_download_11_demos_itom_ui_demo_splitter.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_splitter.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_splitter.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_splitter.zip `