From a02efa311ffcce283c4508d887d8b77ad3d9cd34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Sbrocco=20Figueiredo?= <33270103+andresbrocco@users.noreply.github.com> Date: Sun, 24 Jan 2021 10:45:34 +0100 Subject: [PATCH] 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 Co-authored-by: matham --- doc/sources/contribute.rst | 4 ++-- kivy/uix/tabbedpanel.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/sources/contribute.rst b/doc/sources/contribute.rst index d02923d34..a4f0fcc98 100644 --- a/doc/sources/contribute.rst +++ b/doc/sources/contribute.rst @@ -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, diff --git a/kivy/uix/tabbedpanel.py b/kivy/uix/tabbedpanel.py index 688a617d0..5247883e1 100644 --- a/kivy/uix/tabbedpanel.py +++ b/kivy/uix/tabbedpanel.py @@ -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 + `_ + for full example. ''' header_content = header.content self._current_tab.state = 'normal'