Python Forum

Full Version: Python 3+ kybd and mouse control keycodes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Where can I find a list of Python keyboard and mouse keycodes and some basic code examples?
If you are looking for GUI automation with keyboard and mouse emulation, check Pywinauto library which has key codes
Check pynput and pyautogui packages.They are crossplatform. @Malt: OP is on Linux, so pywinauto will not do.
(Aug-20-2019, 05:22 AM)buran Wrote: [ -> ]Check pynput and pyautogui packages.They are crossplatform. @Malt: OP is on Linux, so pywinauto will not do.

Sorry I missed out the platform :D
(Aug-20-2019, 05:43 AM)Malt Wrote: [ -> ]Sorry I missed out the platform :D

Don't worry, the original question is ambiguous anyway and OP should provide more info to get relevant advice
I am using Python 3.6 in Linux Mint 19.2 with Autokey 3 which works well in every app, except it does not have mouse support yet.

With the Python keyboard and mouse keycodes I wanted to write a script to standardize the "open and switch to newly opened tab" action of Firefox and the Vivaldi browser.

Firefox (and Chrome/Chromium) accomplishes this with the click of the mouse scroll wheel - a single handed operation.

Vivaldi uses the combination of the <shift>+<left mouse click> for the same action - a two handed operation.

I wondered if I can emulate this with Autokey and use it with Vivaldi.