L
L
leviathan2020-05-12 18:28:25
Python
leviathan, 2020-05-12 18:28:25

Stop playing audio?

There are hot keys on the keyboard, for example: FN + F7 is play / pause. So, how to tell the system in python that you need to press pause?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
chupasaurus, 2020-05-12
@The_Lars

from pynput.Keyboard import Key, Controller

keyboard = Controller()
keyboard.press(Key.media_play_pause)
keyboard.release(Key.media_play_pause)
Buttons for multimedia, launching a browser / search, and a couple more have their own codes (0xA6-B7, you can look here ), which you need to pull in programs.

M
Max Orlov, 2020-05-12
@fsucks

import pyautogui
pyautogui.hotkey('fn', 'f7')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question