alignment - How to have border of different sizes in wxwidgets? -
usually when add particular widget sizer in wxwidgets specify alignment , border flags ( .... ,wxalign_righ | wxleft | wxright , 10 )
my requirement have left border of 10 , right border of 20 , how achieve flag combination or way it?
i don't think can way want to.
have omit wx.right command , add dummy widget box:
hbox.add((dummy,-1, wx.left,20))
if attempting in vertical box:
vbox.add((-1, 20))
e.g.
#!/usr/bin/python # -*- coding: utf-8 -*- # border.py import wx class example(wx.frame): def __init__(self, parent, title): super(example, self).__init__(parent, title=title, size=(260, 180)) self.initui() self.centre() self.show() def initui(self): panel = wx.panel(self) panel.setbackgroundcolour('#4f5049') vbox = wx.boxsizer(wx.vertical) hbox = wx.boxsizer(wx.horizontal) midpan = wx.panel(panel) midpan.setbackgroundcolour('#ededed') dummy = wx.statictext(panel, wx.id_any, "") midpan2 = wx.panel(panel) midpan2.setbackgroundcolour('#1f1f1f') hbox.add(midpan, -1, wx.left|wx.top, border=10 ) hbox.add(dummy,-1, wx.left,border=20) hbox.add(midpan2, -1, wx.right, border=10) vbox.add(hbox) panel.setsizer(vbox) if __name__ == '__main__': app = wx.app() example(none, title='border') app.mainloop()
Comments
Post a Comment