more reliable pause (#1993)

This commit is contained in:
Will McGugan
2023-03-09 09:45:34 +00:00
committed by GitHub
parent 8cb28b6668
commit 3a627e0881
2 changed files with 3 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ Build sophisticated user interfaces with a simple Python API. Run your apps in t
```{.textual path="examples/calculator.py" columns=100 lines=41 press="3,.,1,4,5,9,2,_,_,_,_,_,_,_,_"} ```{.textual path="examples/calculator.py" columns=100 lines=41 press="3,.,1,4,5,9,2,wait:400"}
``` ```
```{.textual path="examples/pride.py"} ```{.textual path="examples/pride.py"}

View File

@@ -868,6 +868,8 @@ class App(Generic[ReturnType], DOMNode):
_, wait_ms = key.split(":") _, wait_ms = key.split(":")
print(f"(pause {wait_ms}ms)") print(f"(pause {wait_ms}ms)")
await asyncio.sleep(float(wait_ms) / 1000) await asyncio.sleep(float(wait_ms) / 1000)
await app._animator.wait_until_complete()
await wait_for_idle(0)
else: else:
if len(key) == 1 and not key.isalnum(): if len(key) == 1 and not key.isalnum():
key = _character_to_key(key) key = _character_to_key(key)