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()