wx.lib.buttonpanel alignmentproblem

Hello,

I am using wx.lib.ButtonPanel. To align the panel I use: alignment=bp.BP_ALIGN_RIGHT.

The problem is that instead of the buttons shifting to the left and the text aligning to the right, the buttons stay in place (right aligned) and the text moves towards the right against the buttons instead of being aligned to the most right side.

I tried the demo.py and when using the ButtonPanel demo, choosing align right in the menu shows the correct behaviour. I can’t find what I’m doing different. However when I change the code of the demo to start with right alignment instead of left alignment, the demo shows what also goes wrong in my prog.

Do other people also have this problem? And do you have a solution?

Thx in advance!!

my test:

import wx
import wx.lib.agw.buttonpanel as bp

class MyFrame(wx.Frame):

def __init__(self, parent, id=-1, title="ButtonPanel", pos=wx.DefaultPosition,
             size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
          
    wx.Frame.__init__(self, parent, id, title, pos, size, style)

    mainPanel = wx.Panel(self, -1)
    self.logtext = wx.TextCtrl(mainPanel, -1, "", style=wx.TE_MULTILINE)

    vSizer = wx.BoxSizer(wx.VERTICAL)
    mainPanel.SetSizer(vSizer)

    alignment = bp.BP_ALIGN_RIGHT

    titleBar = bp.ButtonPanel(mainPanel, -1, "A Simple Test & Demo",alignment=alignment)

    btn1 = bp.ButtonInfo(titleBar,wx.NewId(), wx.Image("/media/Cruzer/Python/pictowriter/art/tb/left.png",wx.BITMAP_TYPE_ANY).ConvertToBitmap())
    titleBar.AddButton(btn1)

    btn2 = bp.ButtonInfo(titleBar,wx.NewId(), wx.Image("/media/Cruzer/Python/pictowriter/art/tb/left.png",wx.BITMAP_TYPE_ANY).ConvertToBitmap())
    titleBar.AddButton(btn2)

    btn3 = bp.ButtonInfo(titleBar,wx.NewId(), wx.Image("/media/Cruzer/Python/pictowriter/art/tb/left.png",wx.BITMAP_TYPE_ANY).ConvertToBitmap())
    titleBar.AddButton(btn3)

    btn4 = bp.ButtonInfo(titleBar,wx.NewId(), wx.Image("/media/Cruzer/Python/pictowriter/art/tb/left.png",wx.BITMAP_TYPE_ANY).ConvertToBitmap())
    titleBar.AddButton(btn4)

    vSizer.Add(titleBar, 0, wx.EXPAND)
    vSizer.Add((20, 20))
    vSizer.Add(self.logtext, 1, wx.EXPAND|wx.ALL, 5)

    vSizer.Layout()

app = wx.PySimpleApp()

frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()

app.MainLoop()

···

Heb jij de nieuwe Messenger nog niet?! Download 'm hier

Hi,

Hello,

I am using wx.lib.ButtonPanel. To align the panel I use:
alignment=bp.BP_ALIGN_RIGHT.

The problem is that instead of the buttons shifting to the left and the text
aligning to the right, the buttons stay in place (right aligned) and the
text moves towards the right against the buttons instead of being aligned to
the most right side.

I tried the demo.py and when using the ButtonPanel demo, choosing align
right in the menu shows the correct behaviour. I can't find what I'm doing
different. However when I change the code of the demo to start with right
alignment instead of left alignment, the demo shows what also goes wrong in
my prog.

Do other people also have this problem? And do you have a solution?

Thx in advance!!

Your sample is not directly runnable as you include hard-coded paths
to images we do not have. Anyway, I'll take a look tomorrow morning
and see if there is anything wrong about ButtonPanel and possibly fix
it in SVN.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Mon, May 25, 2009 at 11:15 PM, Bart Smeets wrote:

Hi Bart,

···

On Mon, May 25, 2009 at 11:15 PM, Bart Smeets wrote:

Hello,

I am using wx.lib.ButtonPanel. To align the panel I use:
alignment=bp.BP_ALIGN_RIGHT.

The problem is that instead of the buttons shifting to the left and the text
aligning to the right, the buttons stay in place (right aligned) and the
text moves towards the right against the buttons instead of being aligned to
the most right side.

I tried the demo.py and when using the ButtonPanel demo, choosing align
right in the menu shows the correct behaviour. I can't find what I'm doing
different. However when I change the code of the demo to start with right
alignment instead of left alignment, the demo shows what also goes wrong in
my prog.

Do other people also have this problem? And do you have a solution?

Please enter a bug report on wxTrac so that I won't forget to check
for a fix when I'll have some more time.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/