views:

40

answers:

1

Hello.

I use wxPython to sketch up a user interface for the a python program. I need to put 2 toolbars on the same row. One toolbar is on the left while the other is on the right.

I use BoxSizer to achieve this (by putting a stretchable space between 2 toolbars)

However, the stretchable space produces a blank space between 2 toolbars and there is no underline for that space, hence, it looks ugly. (Please prefer to this picture to know what I mean http://i55.tinypic.com/2dlrvaa.jpg).

The underlines are supposed to be connected to each other so that they look like just one toolbar in total. They are discrete because of the stretchable space.

Is there any solution I can try to overcome this? I guess I can either remove the underlines for the toolbar, or add underline to the blank space. However I don't know how to achieve either way of these. Please help.

Thank you very much.

Here is part of my code:

# Create the top toolbar container
topToolBar = wx.BoxSizer(wx.HORIZONTAL)

# Add 2 toolbars to this sizer, with stretchable space 
# We add the same toolbar for testing purpose
topToolBar.Add(toolbar1,0,wx.ALIGN_LEFT,4) # add the toolbar to the sizer
topToolBar.AddStretchSpacer()
topToolBar.Add(toolbar1,0,wx.ALIGN_RIGHT ,4)

self.SetSizer(topToolBar)    
A: 

It's been a while since I used wxPython, but have you tried removing the spacer and setting the proportion of the first toolbar to greater than that of the second? Eg

topToolBar.Add(toolbar1,1,wx.ALIGN_LEFT,4) # note the 2nd param 'proportion' is 1
#topToolBar.AddStretchSpacer()
topToolBar.Add(toolbar1,0,wx.ALIGN_RIGHT,4)

The idea being that the first toolbar expands to fill the available space.

Peter Gibson
thank you very much, that does the trick (I've been stuck on this for 4 hrs long) :D ( I dont know what version neither, 2.8 or something, I just ticked and installed wxpython from ubuntu 9.04 repository)
markbse