I'm writing an email client, and need to setup my panes. I arranged the
screen with wxSplitterWindows and placed wxHtmlWindows inside them, which
seems to work. However, I can't seem to get a default sash position. I've
called SetSashPosition, but it's ignored. I've tried setting the size of
the HtmlWindows at creation. I've tried calling SetSize on the HtmlWindows.
I've copied from every demo and sample I could find. Then I gave up on
splitters and rewrote the program to use BoxSizers, but I couldn't find a
way to change their sizes in relation to each other AFTER the program was
running. SetSize didn't seem to do anything, and the user is likely to want
to resize the panes to suit himself, not the built-in stretching ratios.
Then I rewrote the program again using wxSashLayoutWindows, but I couldn't
ever get them to match the layout of my splitters, though I was able to set
the sash positions perfectly.
So, if someone could fix my splitter sash positions, or tell me how to
layout a SashLayoutWindow to match this layout, I'd name my next child after
you.
Here's the stripped-down splitter code I began with:
from wxPython.wx import *
from wxPython.html import *
class mainWindow(wxFrame):
def __init__(self, parent, id, title):
wxFrame.__init__(self, parent, -1, title, size=(800,600))
# To split screen into left/right
splitter1 = wxSplitterWindow(self, -1)
self.addressPane = wxHtmlWindow(splitter1, -1)
# To split right side in half again
splitter2 = wxSplitterWindow(splitter1, -1)
self.mainPane = wxHtmlWindow(splitter2, -1)
# To split right half of right half into top/bottom
splitter3 = wxSplitterWindow(splitter2, -1)
self.folderPane = wxHtmlWindow(splitter3, -1)
self.previewPane = wxHtmlWindow(splitter3, -1)
splitter1.SetMinimumPaneSize(100)
splitter1.SplitVertically(self.addressPane, splitter2)
splitter1.SetSashPosition(150)
splitter2.SetMinimumPaneSize(250)
splitter2.SplitVertically(self.mainPane, splitter3)
splitter2.SetSashPosition(450)
splitter3.SetMinimumPaneSize(100)
splitter3.SplitHorizontally(self.folderPane, self.previewPane)
splitter3.SetSashPosition(150)
self.Maximize(true)
self.Show(true)
if __name__ == "__main__":
a = wxPySimpleApp()
frame = mainWindow(None, -1, "Goshdarn Splitters!")
a.MainLoop()