TabbedPanel: Doc calling `switch_to` from `__init__` (#7342)

* Fixed reference

Previous reference didn't link to anywhere, and now it links to the
dev-install page.

* Added link for example usage

As discussed in the issue #3493, when calling this method from the
python script, it has to be scheduled to the next clock cycle.

* Update kivy/uix/tabbedpanel.py

Co-authored-by: matham <moiein2000@gmail.com>

Co-authored-by: matham <moiein2000@gmail.com>
This commit is contained in:
André Sbrocco Figueiredo 2021-01-24 10:45:34 +01:00 committed by GitHub
parent 72f2144882
commit a02efa311f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -138,7 +138,7 @@ Code Workflow
So here is the initial setup to begin with our workflow (you only need to do
this once to install Kivy). Basically you follow the installation
instructions from :ref:`dev-install`, but you don't clone our repository,
instructions from :ref:`kivy-dev-install`, but you don't clone our repository,
you fork it. Here are the steps:
#. Log in to GitHub
@ -149,7 +149,7 @@ you fork it. Here are the steps:
git clone https://github.com/username/kivy.git
#. Compile and set up PYTHONPATH or install (see :ref:`dev-install`).
#. Compile and set up PYTHONPATH or install (see :ref:`kivy-dev-install`).
#. Install our pre-commit hook that ensures your code doesn't violate our
styleguide by executing `make hook` from the root directory of your
clone. This will run our styleguide check whenever you do a commit,

View File

@ -500,6 +500,12 @@ class TabbedPanel(GridLayout):
If used with `do_scroll=True`, it scrolls
to the header's tab too.
:meth:`switch_to` cannot be called from within the
:class:`TabbedPanel` or its subclass' ``__init__`` method.
If that is required, use the ``Clock`` to schedule it. See `discussion
<https://github.com/kivy/kivy/issues/3493#issuecomment-121567969>`_
for full example.
'''
header_content = header.content
self._current_tab.state = 'normal'