[PyQt] How to get index of splitter

F.A.Pinkse fapinkse at gmail.com
Thu Jun 17 12:37:49 BST 2010


Hello russell,


Hmm, I thought .show() was a mere visible or not thing.

Ok, It solved my problem of not knowing the size before I do a setSizes().

Calculating the numbers is totally clear.

I am still puzzelled though what setSizes() is doing when you give it 
numbers not summing up to what splitter.sizes() reports.

like;
splitter.sizes() reports [500,500]
and you do a
splitter.setSizes(2,8)

Thanks again, for your patients and pointing me my shortcummings.


With ebst regards.

Frans.

Op 6/17/2010 3:03 AM, Russell Valentine schreef:
> 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