Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include mouse cursor in screenshot

I'm making a program that streams my screen to another computer(like TeamViewer), I'm using sockets, PIL ImageGrab, Tkinter.

Everything is fine but the screenshot I get from ImageGrab.grab() is without the mouse cursor, which is very important for my program purpose.

Do you know how can I take screenshot with the mouse cursor?

like image 710
PRO GRAMMER Avatar asked Apr 08 '15 20:04

PRO GRAMMER


1 Answers

The cursor isn't on the same layer as the desktop or game your playing, so a screenshot won't capture it (try printscreen and paste into mspaint). A workaround is to get the position of the cursor and draw it on the image. you could use win32gui.GetCursorPos(point) for windows.

like image 141
Zelnoth Avatar answered Nov 17 '22 04:11

Zelnoth