X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd3f2efe791cf99c2e4944cd615f02a5502ed93e..e1f4ff6ddc69a37e8922b8617e1edec3fd71d670:/wxPython/demo/wxScrolledPanel.py diff --git a/wxPython/demo/wxScrolledPanel.py b/wxPython/demo/wxScrolledPanel.py index a0e89ae421..e1eca01c8d 100644 --- a/wxPython/demo/wxScrolledPanel.py +++ b/wxPython/demo/wxScrolledPanel.py @@ -1,18 +1,27 @@ -from wxPython.wx import * -from wxPython.lib.scrolledpanel import wxScrolledPanel +# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o Updated for wx namespace +# +# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o scrolledpanel lib needs wx update +# + +import wx +import wx.lib.scrolledpanel as scrolled #---------------------------------------------------------------------- text = "one two buckle my shoe three four shut the door five six pick up sticks seven eight lay them straight nine ten big fat hen" -class TestPanel(wxScrolledPanel): +class TestPanel(scrolled.wxScrolledPanel): def __init__(self, parent, log): self.log = log - wxScrolledPanel.__init__(self, parent, -1) + scrolled.wxScrolledPanel.__init__(self, parent, -1) - vbox = wxBoxSizer(wxVERTICAL) - desc = wxStaticText(self, -1, + vbox = wx.BoxSizer(wx.VERTICAL) + desc = wx.StaticText(self, -1, "wxScrolledPanel extends wxScrolledWindow, adding all " "the necessary bits to set up scroll handling for you.\n\n" "Here are three fixed size examples of its use. The " @@ -21,46 +30,46 @@ class TestPanel(wxScrolledPanel): "activated." ) desc.SetForegroundColour("Blue") - vbox.Add(desc, 0, wxALIGN_LEFT|wxALL, 5) - vbox.Add(wxStaticLine(self, -1, size=(1024,-1)), 0, wxALL, 5) + vbox.Add(desc, 0, wx.ALIGN_LEFT|wx.ALL, 5) + vbox.Add(wx.StaticLine(self, -1, size=(1024,-1)), 0, wx.ALL, 5) vbox.Add((20,20)) words = text.split() - panel1 = wxScrolledPanel(self, -1, size=(120,300), - style = wxTAB_TRAVERSAL|wxSUNKEN_BORDER ) - fgs1 = wxFlexGridSizer(cols=2, vgap=4, hgap=4) + panel1 = scrolled.wxScrolledPanel(self, -1, size=(120,300), + style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER ) + fgs1 = wx.FlexGridSizer(cols=2, vgap=4, hgap=4) for word in words: - label = wxStaticText(panel1, -1, word+":") - tc = wxTextCtrl(panel1, -1, word, size=(50,-1)) - fgs1.Add(label, flag=wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL) - fgs1.Add(tc, flag=wxEXPAND|wxRIGHT, border=25) + label = wx.StaticText(panel1, -1, word+":") + tc = wx.TextCtrl(panel1, -1, word, size=(50,-1)) + fgs1.Add(label, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) + fgs1.Add(tc, flag=wx.EXPAND|wx.RIGHT, border=25) panel1.SetSizer( fgs1 ) panel1.SetAutoLayout(1) panel1.SetupScrolling( scroll_x=False ) - panel2 = wxScrolledPanel(self, -1, size=(350, 40), - style = wxTAB_TRAVERSAL|wxSUNKEN_BORDER) - panel3 = wxScrolledPanel(self, -1, size=(200,100), - style = wxTAB_TRAVERSAL|wxSUNKEN_BORDER) + panel2 = scrolled.wxScrolledPanel(self, -1, size=(350, 40), + style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER) + panel3 = scrolled.wxScrolledPanel(self, -1, size=(200,100), + style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER) - fgs2 = wxFlexGridSizer(cols=25, vgap=4, hgap=4) - fgs3 = wxFlexGridSizer(cols=5, vgap=4, hgap=4) + fgs2 = wx.FlexGridSizer(cols=25, vgap=4, hgap=4) + fgs3 = wx.FlexGridSizer(cols=5, vgap=4, hgap=4) for i in range(len(words)): word = words[i] if i % 5 != 4: - label2 = wxStaticText(panel2, -1, word) - fgs2.Add(label2, flag=wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL) - label3 = wxStaticText(panel3, -1, word) - fgs3.Add(label3, flag=wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL) + label2 = wx.StaticText(panel2, -1, word) + fgs2.Add(label2, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) + label3 = wx.StaticText(panel3, -1, word) + fgs3.Add(label3, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) else: - tc2 = wxTextCtrl(panel2, -1, word, size=(50,-1)) - fgs2.Add(tc2, flag=wxLEFT, border=5) - tc3 = wxTextCtrl(panel3, -1, word ) - fgs3.Add(tc3, flag=wxLEFT, border=5) + tc2 = wx.TextCtrl(panel2, -1, word, size=(50,-1)) + fgs2.Add(tc2, flag=wx.LEFT, border=5) + tc3 = wx.TextCtrl(panel3, -1, word ) + fgs3.Add(tc3, flag=wx.LEFT, border=5) panel2.SetSizer( fgs2 ) panel2.SetAutoLayout(1) @@ -70,12 +79,12 @@ class TestPanel(wxScrolledPanel): panel3.SetAutoLayout(1) panel3.SetupScrolling() - hbox = wxBoxSizer(wxHORIZONTAL) + hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((20,20)) hbox.Add(panel1, 0) hbox.Add((40, 10)) - vbox2 = wxBoxSizer(wxVERTICAL) + vbox2 = wx.BoxSizer(wx.VERTICAL) vbox2.Add(panel2, 0) vbox2.Add((20, 50)) @@ -103,7 +112,7 @@ def runTest(frame, nb, log): overview = """ wxScrolledPanel fills a "hole" in the implementation of wxScrolledWindow, providing automatic scrollbar and scrolling behavior and the tab traversal -management that wxScrolledWindow lacks. +mangement that wxScrolledWindow lacks. """