From 65c827d4220d42f8f609e6a9238c467d787414dd Mon Sep 17 00:00:00 2001 From: Kevin Zakka Date: Fri, 21 Jul 2023 12:09:49 -0700 Subject: [PATCH] Fix typo in `key_callback` example. PiperOrigin-RevId: 550013932 Change-Id: I418f49eee97e73d1b0218acc7e9259acaefb5edd --- doc/python.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/python.rst b/doc/python.rst index 44cd8060..46e8222d 100644 --- a/doc/python.rst +++ b/doc/python.rst @@ -161,7 +161,7 @@ illustrative example that does **not** necessarily keep the physics ticking at t time.sleep(time_until_next_step) Optionally, ``viewer.launch_passive`` also accepts a callable as a keyword argument ``key_callback``, which gets called -each time a keyboard event occurs in the viewer window. This allows user scripts to react to various key presses, e.g. +each time a keyboard event occurs in the viewer window. This allows user scripts to react to various key presses, e.g., pause or resume the run loop when the spacebar is pressed. .. code-block:: python @@ -170,7 +170,7 @@ pause or resume the run loop when the spacebar is pressed. def key_callback(keycode): if chr(keycode) == ' ': - global paused + nonlocal paused paused = not paused ...