python - WxPython wxSplitterWindow.SplitVertically always shows uneven split -
i'm trying understand how use wxsplitterwindow class can't seem vertical split (i.e. left , right panes each take same amount of space). according wxpython 3.03 documentation, wxsplitterwindow.splitvertically has following signature:
splitvertically(self, window1, window2, sashposition=0)
the last parameter sashposition
has following description:
sashposition - initial position of sash. if value positive, specifies size of left pane. if negative, absolute value gives size of right pane. finally, specify 0 (default) choose default position (half of total window width).
from description, gather passing 0 sashposition
splits window in half left , right panes taking equal space. however, when run following example program, window uneven split of left panel hidden.
import wx class splitterframe(wx.frame): def __init__(self): wx.frame.__init__(self, none, title='splitterwindow example') # create main splitter window (to split vertically) self.splitter = wx.splitterwindow(self) self.rightpanel = wx.panel (self.splitter) self.rightpanel.setbackgroundcolour(wx.blue) self.leftpanel = wx.panel (self.splitter) self.leftpanel.setbackgroundcolour(wx.red) # expecting split call self.splitter.splitvertically (self.leftpanel, self.rightpanel, 0) if __name__ == '__main__': app = wx.app(0) frame = splitterframe() frame.show() app.mainloop()
i'm running python v2.7.10 using wxpython v3.0 toolkit on windows 8.1 machine.
i had same problem, trial, , error modification solved problem
self.splitter.splithorizontally(self.leftpanel, self.rightpanel, 100)
but dependent on size of frame.
i'm using wxpython version 3.0.0.0
Comments
Post a Comment