Skip to content

Commit 8d2bdaa

Browse files
committed
Docs: Add an example of using block_input
1 parent 494571b commit 8d2bdaa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/api.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,15 @@ In the following functions, the *key_name* argument is a VK or SC code, such as
241241
Input Blocking
242242
~~~~~~~~~~~~~~
243243

244-
A couple of context managers to block user input.
244+
A couple of context managers to block user input::
245+
246+
with ahkpy.block_input():
247+
subprocess.Popen(["notepad"])
248+
ahkpy.windows.wait_active("Untitled - Notepad")
249+
ahkpy.send("{F5}") # Pastes time and date
250+
251+
Use sparingly. Prefer the Input and Play send modes instead, because they buffer
252+
the user input while sending.
245253

246254
.. autofunction:: block_input
247255

0 commit comments

Comments
 (0)