X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/299647acac7960652aadb008775429c1f8ea9b8d..30e24d9dd5a5abf1c9a375ea259eb239b122b7f7:/wxPython/demo/ScrolledPanel.py diff --git a/wxPython/demo/ScrolledPanel.py b/wxPython/demo/ScrolledPanel.py index 947051cf1a..e5226cf728 100644 --- a/wxPython/demo/ScrolledPanel.py +++ b/wxPython/demo/ScrolledPanel.py @@ -1,22 +1,6 @@ -# 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 -# -# 12/11/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o lib updated, all is well. -# -# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o wxScrolledPanel -> ScrolledPanel -# import wx -import wx.lib.scrolledpanel as scrolled +import wx.lib.scrolledpanel as scrolled #---------------------------------------------------------------------- @@ -33,7 +17,7 @@ class TestPanel(scrolled.ScrolledPanel): "ScrolledPanel extends wx.ScrolledWindow, adding all " "the necessary bits to set up scroll handling for you.\n\n" "Here are three fixed size examples of its use. The " - "demo panel for this sample is also using it -- the \nwxStaticLine" + "demo panel for this sample is also using it -- the \nwxStaticLine " "below is intentionally made too long so a scrollbar will be " "activated." ) @@ -44,24 +28,32 @@ class TestPanel(scrolled.ScrolledPanel): words = text.split() - panel1 = scrolled.ScrolledPanel(self, -1, size=(120,300), - style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER ) + panel1 = scrolled.ScrolledPanel(self, -1, size=(140, 300), + style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER, name="panel1" ) fgs1 = wx.FlexGridSizer(cols=2, vgap=4, hgap=4) for word in words: label = wx.StaticText(panel1, -1, word+":") + + # A test for scrolling with a too big control + #if word == "three": + # tc = wx.TextCtrl(panel1, -1, word, size=(150,-1)) + #else: + # tc = wx.TextCtrl(panel1, -1, word, size=(50,-1)) + 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) + + fgs1.Add(label, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=10) + fgs1.Add(tc, flag=wx.RIGHT, border=10) panel1.SetSizer( fgs1 ) panel1.SetAutoLayout(1) - panel1.SetupScrolling( scroll_x=False ) + panel1.SetupScrolling() - panel2 = scrolled.ScrolledPanel(self, -1, size=(350, 40), - style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER) + panel2 = scrolled.ScrolledPanel(self, -1, size=(350, 50), + style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER, name="panel2") panel3 = scrolled.ScrolledPanel(self, -1, size=(200,100), - style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER) + style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER, name="panel3") fgs2 = wx.FlexGridSizer(cols=25, vgap=4, hgap=4) fgs3 = wx.FlexGridSizer(cols=5, vgap=4, hgap=4) @@ -89,18 +81,18 @@ class TestPanel(scrolled.ScrolledPanel): hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add((20,20)) - hbox.Add(panel1, 0) + hbox.Add(panel1, 0, wx.FIXED_MINSIZE) hbox.Add((40, 10)) vbox2 = wx.BoxSizer(wx.VERTICAL) - vbox2.Add(panel2, 0) + vbox2.Add(panel2, 0, wx.FIXED_MINSIZE) vbox2.Add((20, 50)) - vbox2.Add(panel3, 0) + vbox2.Add(panel3, 0, wx.FIXED_MINSIZE) vbox2.Add((20, 10)) hbox.Add(vbox2) - vbox.AddSizer(hbox, 0) + vbox.Add(hbox, 0) self.SetSizer(vbox) self.SetAutoLayout(1) self.SetupScrolling() @@ -128,4 +120,4 @@ mangement that wx.ScrolledWindow lacks. if __name__ == '__main__': import sys,os import run - run.main(['', os.path.basename(sys.argv[0])]) + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])