summaryrefslogtreecommitdiff
path: root/mpv.py
diff options
context:
space:
mode:
authorNaglis Jonaitis <naglis@mailbox.org>2022-05-16 02:03:31 +0300
committerjaseg <136313+jaseg@users.noreply.github.com>2022-06-17 00:13:21 +0200
commit20ec2a74b8c407e1fcaabb1554a4acd83bb57bb9 (patch)
tree58eb971e3bee56e4c81cf7fd56cc8120cef9c0b1 /mpv.py
parentdd4d016de8eb7f79c9fa0810e9e3dc59f949a2de (diff)
downloadpython-mpv-20ec2a74b8c407e1fcaabb1554a4acd83bb57bb9.tar.gz
python-mpv-20ec2a74b8c407e1fcaabb1554a4acd83bb57bb9.tar.bz2
python-mpv-20ec2a74b8c407e1fcaabb1554a4acd83bb57bb9.zip
Fix `observe_property()` docstring
1. Fix decorator name - the decorator for property observation handlers is `@property_observer()`. 2. Fix handler's unregistration method name 3. Fix handler function signature - the signature is ``fun(property_name, new_value)`` and we can't have a bare `*` with no names after it. 4. Fix undefined variable in the example
Diffstat (limited to 'mpv.py')
-rw-r--r--mpv.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mpv.py b/mpv.py
index f1d5424..1f4f1e8 100644
--- a/mpv.py
+++ b/mpv.py
@@ -1483,13 +1483,13 @@ class MPV(object):
function decorator if no handler is given.
To unregister the observer, call either of ``mpv.unobserve_property(name, handler)``,
- ``mpv.unobserve_all_properties(handler)`` or the handler's ``unregister_mpv_properties`` attribute::
+ ``mpv.unobserve_all_properties(handler)`` or the handler's ``unobserve_mpv_properties`` attribute::
- @player.observe_property('volume')
- def my_handler(new_volume, *):
- print("It's loud!", volume)
+ @player.property_observer('volume')
+ def my_handler(property_name, new_volume):
+ print("It's loud!", new_volume)
- my_handler.unregister_mpv_properties()
+ my_handler.unobserve_mpv_properties()
exit_handler is a function taking no arguments that is called when the underlying mpv handle is terminated (e.g.
from calling MPV.terminate() or issuing a "quit" input command).