-1

i wanted to make a caps-lock and num-lock indicator using python on windows, but i dont know how to start with and what all modules and library i need to implement my desired output.

THE OUTPUT i desire is that whenever i press CAPS-LOCK the borders of screen should go green and for *NUM-LOCK** blue.

also, does it require a GUI?

(but i want it to be transparent. i don't want minimise,close and maximise buttons on gui) and this all process should be done in background.

Please guide me on how should i approach this. THANKS A LOT.

  • Questions that ask "where do I start?" are typically too broad and are not a good fit for this site. People have their own method for approaching the problem and because of this there cannot be a _correct_ answer. Give a good read over [Where to Start](https://softwareengineering.meta.stackexchange.com/questions/6366/where-to-start/6367#6367) and [edit] your post. – Patrick Artner Jan 20 '19 at 16:30

1 Answers1

0

There's the WinApi package for python here.

Not very well documented, but after quick look at demos looks like this code works:

import win32api
import win32con
print(win32api.GetKeyState(win32con.VK_CAPITAL))

For green frame you'll need probably some GUI library (GTK+, Qt), but I don't know which one could achieve such effect.

Edit: I figured you can actually use the same WinApi to draw on the screen.

import win32api
import win32gui
import win32con

pen = win32gui.CreatePen(win32con.PS_SOLID, 7, win32api.RGB(255, 0, 0))
dc = win32gui.GetDC(0)
win32gui.SelectObject(dc, pen)
win32gui.MoveToEx(dc, 0, 0)
win32gui.LineTo(dc, 1920, 0)
szatkus
  • 1,292
  • 6
  • 14