diff options
author | jaseg <code@jaseg.net> | 2017-08-21 15:36:03 +0200 |
---|---|---|
committer | jaseg <code@jaseg.net> | 2017-08-21 15:36:03 +0200 |
commit | 2ca5c7b9c88960994a9b1494f46bd01c0388a21f (patch) | |
tree | 9e35987d3ffcf389954cb748b62ca82f88461bce /README.rst | |
parent | 14783b2193759ee5a45654634a0bb863576df4d9 (diff) | |
download | python-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.rst | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -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() |