I'd like to find out the easiest way how to read Fn key from my keyboard in Python (Windows).I've tried to use Pygame library, but it didn't work for Fn key.
Asked
Active
Viewed 2,553 times
2
-
possible duplicate of [Intercepting the Fn key on laptops](http://stackoverflow.com/questions/514781/intercepting-the-fn-key-on-laptops) – Josh Lee Oct 10 '11 at 13:35
-
Tkinter can catch function keys. See http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm. – Steven Rumbalski Oct 10 '11 at 13:53
-
@StevenRumbalski: Where's the bit on that page that says Fn can be caught by Tkinter? Note that this is `"Fn"`, not `"F"+n`. – Lightness Races in Orbit Oct 21 '11 at 10:23
-
@Tomalak Geret'kal: My mistake. +1 on on your answer. – Steven Rumbalski Oct 21 '11 at 13:38
1 Answers
5
The "Fn" key is usually a proprietary, device-specific modifier that is handled by the device driver (or the hardware itself). It's not a normal button, and you can't catch it in your code. To be honest, I can't imagine why you'd ever possibly want to.

Lightness Races in Orbit
- 378,754
- 76
- 643
- 1,055
-
Usually it is handled by hardware, though on some keyboards pressing it alone generates scancode too – hamstergene Oct 10 '11 at 13:38
-
If it generates a scancode, Pygame should be able to process it. The value of the scancode would depend on hardware anyway, though. – Petr Viktorin Oct 10 '11 at 14:00
-
@Tomalak Geret'kal I'd like to create program with my own shortcuts usable in Windows. – Stanyko Oct 21 '11 at 10:16
-
@Stanyko: Create your own brand of keyboard then. Fn is not for you. – Lightness Races in Orbit Oct 21 '11 at 10:22