phoenix_title wx.lib.scrolledpanel.ScrolledPanel

ScrolledPanel fills a “hole” in the implementation of ScrolledWindow, providing automatic scrollbar and scrolling behavior and the tab traversal management that ScrolledWindow lacks.


class_hierarchy Class Hierarchy

Inheritance diagram for class ScrolledPanel:

super_classes Known Superclasses

wx.ScrolledWindow


method_summary Methods Summary

__init__

Default class constructor.

GetChildRectRelativeToSelf

Same as child.GetRect() except the position returned is relative

OnChildFocus

If the child window that gets the focus is not fully visible,

ScrollChildIntoView

Scroll the panel so that the specified child window is in view.

SetupScrolling

This function sets up the event handling necessary to handle


api Class API

class ScrolledPanel(wx.ScrolledWindow)

ScrolledPanel fills a “hole” in the implementation of ScrolledWindow, providing automatic scrollbar and scrolling behavior and the tab traversal management that ScrolledWindow lacks.


Methods

__init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL, name='scrolledpanel')

Default class constructor.

Parameters:
  • parent (wx.Window) – parent window. Must not be None;

  • id (integer) – window identifier. A value of -1 indicates a default value;

  • pos (tuple or wx.Point) – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;

  • size (tuple or wx.Size) – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;

  • style (integer) – the underlying wx.ScrolledWindow style;

  • name (string) – the scrolled panel name.



GetChildRectRelativeToSelf(self, child: wx.Window)

Same as child.GetRect() except the position returned is relative to this ScrolledPanel rather than the child’s parent.

Parameters:

child (wx.Window) – any wx.Window - derived control.

Note

window.GetRect returns the size of a window, and its position relative to its parent. When calculating ScrollChildIntoView, the position relative to its parent is not relevant unless the parent is the ScrolledPanel itself.



OnChildFocus(self, evt)

If the child window that gets the focus is not fully visible, this handler will try to scroll enough to see it.

Parameters:

evt – a ChildFocusEvent event to be processed.



ScrollChildIntoView(self, child)

Scroll the panel so that the specified child window is in view.

Parameters:

child (wx.Window) – any wx.Window - derived control.

Note

This method looks redundant if evt.Skip() is called as well - the base ScrolledWindow widget now seems to be doing the same thing anyway.



SetupScrolling(self, scroll_x=True, scroll_y=True, rate_x=20, rate_y=20, scrollToTop=True, scrollIntoView=True)

This function sets up the event handling necessary to handle scrolling properly. It should be called within the __init__ function of any class that is derived from ScrolledPanel, once the controls on the panel have been constructed and thus the size of the scrolling area can be determined.

Parameters:
  • scroll_x (bool) – True to allow horizontal scrolling, False otherwise;

  • scroll_y (bool) – True to allow vertical scrolling, False otherwise;

  • rate_x (int) – the horizontal scroll increment;

  • rate_y (int) – the vertical scroll increment;

  • scrollToTop (bool) – True to scroll all way to the top, False otherwise;

  • scrollIntoView (bool) – True to scroll a focused child into view, False otherwise.