-class ScrolledPanel( wx.ScrolledWindow ):
- """\
-ScrolledPanel fills a "hole" in the implementation of wx.ScrolledWindow,
-providing automatic scrollbar and scrolling behavior and the tab traversal
-management that wxScrolledWindow lacks. This code was based on the original
-demo code showing how to do this, but is now available for general use
-as a proper class (and the demo is now converted to just use it.)
-"""
- def __init__(self, parent, id=-1,
- pos = wx.DefaultPosition, size = wx.DefaultSize,
- style = wx.TAB_TRAVERSAL, name = "scrolledpanel"):
-
- wx.ScrolledWindow.__init__(self, parent, -1,
- pos=pos, size=size,
- style=style, name=name)
-
+class ScrolledPanel( wx.PyScrolledWindow ):
+
+ """ ScrolledPanel fills a "hole" in the implementation of
+ wx.ScrolledWindow, providing automatic scrollbar and scrolling
+ behavior and the tab traversal management that wxScrolledWindow
+ lacks. This code was based on the original demo code showing how
+ to do this, but is now available for general use as a proper class
+ (and the demo is now converted to just use it.)
+
+ It is assumed that the ScrolledPanel will have a sizer, as it is
+ used to calculate the minimal virtual size of the panel and etc.
+ """
+
+ def __init__(self, parent, id=-1, pos = wx.DefaultPosition,
+ size = wx.DefaultSize, style = wx.TAB_TRAVERSAL,
+ name = "scrolledpanel"):
+
+ wx.PyScrolledWindow.__init__(self, parent, id,
+ pos=pos, size=size,
+ style=style, name=name)
+ self.SetBestFittingSize(size)