[PyQt] How to get index of splitter

Russell Valentine russ at coldstonelabs.org
Thu Jun 17 02:03:55 BST 2010

I checked out the stuff. The splitter has size 0, 0 at first because
show wasn't called before you ran test().

Sizes will be [widget1_length, widget2_length, widget3_length] if
splitter is a horizontal splitter. In your case it is [widget1_length,
widget2_length]. Obviously you can't set each widgets length longer than
the window length.

So for example if you want the splitter to be 2/3 out so one widget has
2/3 of the area and the other 1/3 you can do something like this
(Assuming show has been called and everything is not hidden of course):

splitter.setSizes(2*sum(splitter.sizes())/3), sum(splitter.size())/3)

So is it behaving like you want now, or are you still having problems?
If it still isn't doing what you would like please explain more of how
you would like it to behave.

Russell Valentine

On 06/16/10 06:34, F.A.Pinkse wrote:
> Hi Russell,
> Very good guess.
> I cheated and removed a lot just to show you what QtDesigner makes of it.
> I attached the cleaned up version to show you.
> I also attached a screenshot of the QtDesigner Object browser.
> Not everything is visible in QtDesigner, like the layout connection
> between the splitter and the tabWidget.
> This is what it makes the contents of the tab to grow/shrink when the
> mainwindow does.
>  Thanks again for thinking outloud with me.
> With best regards,
> Frans.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list