+ self.SetSize(wxSize(350, 300)) # force a redraw so the notebook will draw
+
+
+ def OnCloseWindow(self, event):
+ self.Destroy()
+
+#---------------------------------------------------------------------------
+
+class TestSplitterWindow(wxFrame):
+ def __init__(self, parent):
+ wxFrame.__init__(self, parent, -1, 'Test wxSplitterWindow',
+ wxPyDefaultPosition, wxSize(500, 300))
+
+ splitter = wxSplitterWindow(self, -1)
+
+ p1 = ColoredPanel(splitter, wxRED)
+ wxStaticText(p1, -1, "Panel One", wxPoint(5,5)).SetBackgroundColour(wxRED)
+
+ p2 = ColoredPanel(splitter, wxBLUE)
+ wxStaticText(p2, -1, "Panel Two", wxPoint(5,5)).SetBackgroundColour(wxBLUE)
+
+ splitter.SplitVertically(p1, p2)
+
+
+ def OnCloseWindow(self, event):
+ self.Destroy()
+
+
+#---------------------------------------------------------------------------
+
+class CustomStatusBar(wxStatusBar):
+ def __init__(self, parent):
+ wxStatusBar.__init__(self, parent, -1)
+ self.SetFieldsCount(3)
+
+ self.SetStatusText("A Custom StatusBar...", 0)
+
+ self.cb = wxCheckBox(self, 1001, "toggle clock")
+ EVT_CHECKBOX(self, 1001, self.OnToggleClock)
+ self.cb.SetValue(true)
+
+ # figure out how tall to make it.
+ dc = wxClientDC(self)
+ dc.SetFont(self.GetFont())
+ (w,h, d,e) = dc.GetTextExtent('X')
+ h = int(h * 1.8)
+ self.SetSize(wxSize(100, h))
+
+ # start our timer
+ self.timer = wxPyTimer(self.Notify)
+ self.timer.Start(1000)
+ self.Notify()
+
+
+ # Time-out handler
+ def Notify(self):
+ t = time.localtime(time.time())
+ st = time.strftime("%d-%b-%Y %I:%M:%S", t)
+ self.SetStatusText(st, 2)
+
+ # the checkbox was clicked
+ def OnToggleClock(self, event):
+ if self.cb.GetValue():
+ self.timer.Start(1000)
+ self.Notify()
+ else:
+ self.timer.Stop()
+
+ # reposition the checkbox
+ def OnSize(self, event):
+ rect = self.GetFieldRect(1)
+ print "%s, %s" % (rect.x, rect.y)
+ self.cb.SetPosition(wxPoint(rect.x+2, rect.y+2))
+ self.cb.SetSize(wxSize(rect.width-4, rect.height-4))
+
+
+
+class TestCustomStatusBar(wxFrame):
+ def __init__(self, parent):
+ wxFrame.__init__(self, parent, -1, 'Test Custom StatusBar',
+ wxPyDefaultPosition, wxSize(500, 300))
+ wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
+
+ self.sb = CustomStatusBar(self)
+ self.SetStatusBar(self.sb)
+
+ def OnCloseWindow(self, event):
+ self.sb.timer.Stop()
+ self.Destroy()
+
+
+#---------------------------------------------------------------------------
+
+class TestToolBar(wxFrame):
+ def __init__(self, parent, log):
+ wxFrame.__init__(self, parent, -1, 'Test ToolBar',
+ wxPyDefaultPosition, wxSize(500, 300))
+ self.log = log
+
+ wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
+
+ tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER)
+ #tb = wxToolBar(self, -1, wxPyDefaultPosition, wxPyDefaultSize,
+ # wxTB_HORIZONTAL | wxNO_BORDER | wxTB_FLAT)
+ #self.SetToolBar(tb)
+
+ tb.AddTool(10, wxNoRefBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP),
+ NULL, false, -1, -1, "New")
+ EVT_TOOL(self, 10, self.OnToolClick)
+ EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
+
+ tb.AddTool(20, wxNoRefBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP),
+ NULL, false, -1, -1, "Open")
+ EVT_TOOL(self, 20, self.OnToolClick)
+ EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
+
+ tb.AddSeparator()
+ tb.AddTool(30, wxNoRefBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP),
+ NULL, false, -1, -1, "Copy")
+ EVT_TOOL(self, 30, self.OnToolClick)
+ EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
+
+ tb.AddTool(40, wxNoRefBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP),
+ NULL, false, -1, -1, "Paste")
+ EVT_TOOL(self, 40, self.OnToolClick)
+ EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
+
+ tb.AddSeparator()
+
+ tb.AddTool(50, wxNoRefBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
+ NULL, true, -1, -1, "Toggle this")
+ EVT_TOOL(self, 50, self.OnToolClick)
+ EVT_TOOL_RCLICKED(self, 50, self.OnToolRClick)
+
+ tb.AddTool(60, wxNoRefBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
+ wxNoRefBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP),
+ true, -1, -1, "Toggle with 2 bitmaps")
+ EVT_TOOL(self, 60, self.OnToolClick)
+ EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick)
+
+ tb.Realize()