summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2017-08-21 15:36:03 +0200
committerjaseg <code@jaseg.net>2017-08-21 15:36:03 +0200
commit2ca5c7b9c88960994a9b1494f46bd01c0388a21f (patch)
tree9e35987d3ffcf389954cb748b62ca82f88461bce /README.rst
parent14783b2193759ee5a45654634a0bb863576df4d9 (diff)
downloadpython-mpv-2ca5c7b9c88960994a9b1494f46bd01c0388a21f.tar.gz
python-mpv-2ca5c7b9c88960994a9b1494f46bd01c0388a21f.tar.bz2
python-mpv-2ca5c7b9c88960994a9b1494f46bd01c0388a21f.zip
Add on_key_press
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst18
1 files changed, 8 insertions, 10 deletions
diff --git a/README.rst b/README.rst
index a1f0987..16f4f48 100644
--- a/README.rst
+++ b/README.rst
@@ -85,16 +85,14 @@ Advanced Usage
# Option access, in general these require the core to reinitialize
player['vo'] = 'opengl'
- def my_q_binding(state, key):
- if state[0] == 'd':
- print('THERE IS NO ESCAPE')
- player.register_key_binding('q', my_q_binding)
-
- def my_s_binding(state, key):
- if state[0] == 'd':
- pillow_img = player.screenshot_raw()
- pillow_img.save('screenshot.png')
- player.register_key_binding('s', my_s_binding)
+ @player.on_key_press('q')
+ def my_q_binding():
+ print('THERE IS NO ESCAPE')
+
+ @player.on_key_press('s')
+ def my_s_binding():
+ pillow_img = player.screenshot_raw()
+ pillow_img.save('screenshot.png')
player.play('https://youtu.be/DLzxrzFCyOs')
player.wait_for_playback()