Hi,
When using wx.ALIGN_RIGHT the HGap in a GridBagSizer isn't respected, see script at the end of this mail.
From the wxWidgets help of wxGridSizer.SetHGap :
Sets the horizontal gap (in pixels) between cells in the sizer.
So IMHO the alignment of the control in the cell shouldn't matter, as
the Gap is in between the cells and not part of the cell.
Regards
Adi
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, id, title, pos = wx.DefaultPosition,
size = wx.Size(800,600),
style = wx.DEFAULT_FRAME_STYLE |wx.WANTS_CHARS ,
name="test"):
wx.Frame.__init__(self, parent, id, title, pos, size, style,
name)
psizer = wx.GridBagSizer(2,2)
p = wx.Panel(self, -1)
psizer.SetHGap(50)
psizer.SetVGap(50)
ctrls = {}
ctrls["ctrl1"] = wx.StaticText(p, -1, "Firstname")
psizer.Add(ctrls["ctrl1"], (0,0), flag=wx.ALIGN_RIGHT|wx.ALL)
ctrls["ctrl2"] = wx.TextCtrl(p, -1, name="ctrl2")
psizer.Add(ctrls["ctrl2"], (0,1))
ctrls["ctrl3"] = wx.TextCtrl(p, -1, name="ctrl3")
psizer.Add(ctrls["ctrl3"], (1,0), flag=wx.ALIGN_RIGHT|wx.ALL)
ctrls["ctrl4"] = wx.TextCtrl(p, -1, name="ctrl4")
psizer.Add(ctrls["ctrl4"], (1,1))
p.SetAutoLayout(1)
p.SetSizerAndFit(psizer)
if __name__ == '__main__':
class App(wx.App):
def OnInit(self):
self.frame = MyFrame(None, -1, "Test")
self.frame.Show()
return True
app = App(0)
app.MainLoop()