Skip to content

Commit 76a2948

Browse files
edit docs
1 parent cfa6940 commit 76a2948

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

README.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Clock
22

3-
*Event scheduler designed for asyncgui programs.*
3+
Provides async time-related functionality.
44

55
```python
66
import asyncgui
@@ -14,11 +14,11 @@ async def async_fn():
1414

1515
asyncgui.start(async_fn())
1616
clock.tick(10) # Advances the clock by 10 time units.
17-
clock.tick(10) # Total of 20 time units. The task above will wake up, and prints 'Hello'.
17+
clock.tick(10) # Total of 20 time units. The async_fn will wake up, and prints 'Hello'.
1818
```
1919

2020
The example above effectively illustrate how this module works but it's not practical.
21-
In a real-world program, you probably want to call ``clock.tick()`` in a loop or schedule it to be called repeatedly using another scheduling API.
21+
In a real-world program, you probably want to call ``clock.tick()`` in a main loop.
2222
For example, if you are using `PyGame`, you may want to do:
2323

2424
```python
@@ -33,15 +33,6 @@ while running:
3333
clock.tick(dt)
3434
```
3535

36-
And if you are using `Kivy`, you may want to do:
37-
38-
```python
39-
from kivy.clock import Clock
40-
41-
clock = asyncui_ext.clock.Clock()
42-
Clock.schedule_interval(clock.tick, 0)
43-
```
44-
4536
## Installation
4637

4738
Pin the minor version.
@@ -58,7 +49,3 @@ pip install "asyncgui-ext-clock>=0.5,<0.6"
5849
- CPython 3.12
5950
- CPython 3.13
6051
- PyPy 3.10
61-
62-
## Misc
63-
64-
- [YouTube Demo](https://youtu.be/kPVzO8fF0yg) (with Kivy)

src/asyncgui_ext/clock.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ async def interpolate_scalar(self, start, end, *, duration, step=0, transition=_
336336

337337
interpolate = interpolate_scalar
338338
'''
339-
An alias for :meth:`interpolate_scalar`.
339+
An alias of :meth:`interpolate_scalar`.
340340
341341
.. versionadded:: 0.5.2
342342
'''
@@ -380,7 +380,7 @@ async def interpolate_sequence(self, start, end, *, duration, step=0, transition
380380

381381
interpolate_seq = interpolate_sequence
382382
'''
383-
An alias for :meth:`interpolate_sequence`.
383+
An alias of :meth:`interpolate_sequence`.
384384
'''
385385

386386
def _update(setattr, zip, min, obj, duration, transition, anim_params, task, p_time, dt):
@@ -440,14 +440,24 @@ def _anim_attrs(
440440

441441
def anim_attrs(self, obj, *, duration, step=0, transition=_linear, **animated_properties) -> Awaitable:
442442
'''
443-
Animates attibutes of any object.
443+
Animates attributes of any object.
444444
445445
.. code-block::
446446
447447
import types
448448
449449
obj = types.SimpleNamespace(x=0, size=(200, 300))
450450
await clock.anim_attrs(obj, x=100, size=(400, 400), duration=2)
451+
452+
Only numbers and flat numeric sequences are supported.
453+
Nested sequences and dictionaries are not supported.
454+
455+
.. code-block::
456+
457+
await anim_attrs(obj, dictionary={'x': 1.}) # not supported
458+
await anim_attrs(obj, nested_sequence=[[10, 20, ]]) # not supported
459+
460+
await anim_attrs(obj, number=1, flat_sequence=(100, 200)) # OK
451461
'''
452462
return self._anim_attrs(obj, duration, step, transition, animated_properties)
453463

0 commit comments

Comments
 (0)