.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. module:: wx.lib.scrolledpanel

.. currentmodule:: wx.lib.scrolledpanel

.. highlight:: python



.. _wx.lib.scrolledpanel:

==========================================================================================================================================
|phoenix_title|  **wx.lib.scrolledpanel**
==========================================================================================================================================

:class:`~lib.scrolledpanel.ScrolledPanel` extends :class:`ScrolledWindow`, adding all
the necessary bits to set up scroll handling for you.

Description
===========

:class:`ScrolledPanel` fills a "hole" in the implementation of
:class:`ScrolledWindow`, providing automatic scrollbar and scrolling
behavior and the tab traversal management that :class:`ScrolledWindow`
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 :class:`ScrolledPanel` will have a sizer, as it is
used to calculate the minimal virtual size of the panel and etc.

Usage
=====

Usage example::


    text = '''
    ScrolledPanel extends wx.ScrolledWindow, adding all
    the necessary bits to set up scroll handling for you.

    Here are three fixed size examples of its use. The
    demo panel for this sample is also using it -- the
    wx.StaticLine below is intentionally made too long so a scrollbar will be
    activated.'''

    import wx
    import wx.lib.scrolledpanel as scrolled

    class TestPanel(scrolled.ScrolledPanel):

        def __init__(self, parent):

            scrolled.ScrolledPanel.__init__(self, parent, -1)

            vbox = wx.BoxSizer(wx.VERTICAL)

            desc = wx.StaticText(self, -1, text)

            desc.SetForegroundColour("Blue")
            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))

            self.SetSizer(vbox)
            self.SetupScrolling()


    app = wx.App(0)
    frame = wx.Frame(None, wx.ID_ANY)
    fa = TestPanel(frame)
    frame.Show()
    app.MainLoop()


|class_summary| Classes Summary
===============================

================================================================================ ================================================================================
:ref:`~wx.lib.scrolledpanel.ScrolledPanel`                                       :class:`ScrolledPanel` fills a "hole" in the implementation of
================================================================================ ================================================================================


|


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.lib.scrolledpanel.ScrolledPanel



