I'm attempting to grasp sizers for use in PythonCard. So far I haven't had
much luck getting any desired layouts. As a simple test (or so I thought) I
tried to convert the Message Watcher window to use sizers instead of fixed
positions. The code below is the original source. I commented out the
EVT_SIZE binding in my own failed sizer attempts.
I've attached a picture to show what the window looks like. What I would
like the sizer to provide is the same kind of layout, but with the second
wxCheckBox aligned against the right side of the window. The wxTextCtrl
should grow with window. A bonus would be a minimal width and height for the
window. I currently have the controls on a panel to handle the resizing,
perhaps that is causing part of the problem?
I tried using a combination of nested wxBoxSizers with horizontal and
vertical layouts without success. I even tried doing the layout using
wxDesigner, where I came close, but I couldn't save the source and it never
worked quite right, perhaps because I didn't use spacers between the items?!
Any help would be appreciated,
ka
···
---
class MessageWatcher( wxMiniFrame, EventListener) :
def __init__(self, parent, ID, title, pos, size, parentApp ):
wxMiniFrame.__init__(self, parent, ID, title, pos, size,
wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ)
panel = wxPanel(self, -1)
self.parentApp = parentApp
EVT_SIZE(self, self.onSize)
EVT_CLOSE(self, self.onCloseMe)
self.hideIdle = wxCheckBox(panel, -1, 'Hide idle', wxPoint(1, 1),
wxDefaultSize, wxNO_BORDER)
self.hideIdle.SetValue(true)
self.hideUnused = wxCheckBox(panel, -1, 'Hide unused', wxPoint(80,
1), wxDefaultSize, wxNO_BORDER)
self.hideUnused.SetValue(true)
self.msgHistory = wxTextCtrl(panel, -1, '', wxPoint(0, 30),
wxDefaultSize, style=wxTE_MULTILINE | wxTE_READONLY)
def onSize(self, event):
size = self.GetClientSize()
self.msgHistory.SetSize(wxSize(size.width, size.height - 30))
event.Skip()