python 2.7 - Align control to bottom of panel in wxPython -


i'm trying align controls in wxpython app bottom of panel. here's sample of code:

def __dolayout(self):     vsizer = wx.boxsizer(wx.vertical)     hsizer = wx.boxsizer(wx.horizontal)     hsizer2 = wx.boxsizer(wx.horizontal)      hsizer.add(self.prog, 0, wx.all|wx.expand, 5)     hsizer2.add(self.text, 0, wx.all|wx.expand, 5)      #hsizer.add(self.timer, 0, wx.expand|wx.align_right)      vsizer.add(hsizer2, 0, wx.expand)     vsizer.add(hsizer, 0, wx.align_bottom|wx.expand)      self.setsizer(vsizer) 

i bottom horizontal sizer (hsizer) stretch bottom, or top 1 stretch placing bottom sizer on bottom (that better).

[edit: proposed sulution description]

the proportion parameter defines ratio of how widgets change in defined orientation. let's assume have 3 buttons proportions 0, 1, , 2. added horizontal wx.boxsizer. button proportion 0 not change @ all. button proportion 2 change twice more 1 proportion 1 in horizontal dimension.

from zetcode solution proposed renae lider

with reluctance, @renae-lider answered question has not posted answer.

change 0 1 in line :

vsizer.add(hsizer2, 1, wx.expand) 

this proportion parameter.

the proportion parameter defines ratio of how widgets change in defined orientation.

let's assume have 3 buttons proportions 0, 1, , 2. added horizontal wx.boxsizer. button proportion 0 not change @ all. button proportion 2 change twice more 1 proportion 1 in horizontal dimension.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -