Python Forum
Python 3+ kybd and mouse control keycodes - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python 3+ kybd and mouse control keycodes (/thread-20572.html)



Python 3+ kybd and mouse control keycodes - ineuw - Aug-20-2019

Where can I find a list of Python keyboard and mouse keycodes and some basic code examples?


RE: Python 3+ kybd and mouse control keycodes - Malt - Aug-20-2019

If you are looking for GUI automation with keyboard and mouse emulation, check Pywinauto library which has key codes


RE: Python 3+ kybd and mouse control keycodes - buran - Aug-20-2019

Check pynput and pyautogui packages.They are crossplatform. @Malt: OP is on Linux, so pywinauto will not do.


RE: Python 3+ kybd and mouse control keycodes - Malt - Aug-20-2019

(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


RE: Python 3+ kybd and mouse control keycodes - buran - Aug-20-2019

(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


RE: Python 3+ kybd and mouse control keycodes - ineuw - Aug-20-2019

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.