Skip to content

Commit 28cf1ef

Browse files
committed
Doc that textinput does work on next frame.
1 parent 951f137 commit 28cf1ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kivy/uix/textinput.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,18 @@ class TextInput(Widget):
310310
behavior selects the whole text. More info at
311311
:meth:`on_quad_touch`.
312312
313+
.. warning::
314+
When changing the a :class:`TextInput` parameter that requires
315+
re-drawing, e.g. modifying :attr:`text`, the updates occur on the next
316+
clock cycle and not instantly. This might cause any changes to the
317+
:class:`TextInput` that occur between the modification and the next
318+
cycle to be ignored, or to use the previous values. For example, after
319+
a update to :attr:`text`, changing the cursor in the same clock frame
320+
will move it using the previous text and will likely end up in a
321+
incorrect position. The solution is to schedule any updates to occur
322+
on the next clock cycle using e.g.
323+
:meth:`~kivy.clock.ClockBase.schedule_once`.
324+
313325
.. versionchanged:: 1.7.0
314326
`on_double_tap`, `on_triple_tap` and `on_quad_touch` events added.
315327
'''

0 commit comments

Comments
 (0)