Skip to content

Commit

Permalink
text_follow_mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdoe committed Oct 5, 2023
1 parent d277d4f commit 158696b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions projects/panic/cards/text_follow_mouse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# pip install pywin32
import random,time
import win32gui as g
import win32api as a
from ctypes import windll
from ctypes import wintypes
from ctypes import byref

dc = windll.user32.GetDC(0)
font = g.LOGFONT()
font.lfFaceName = "Consolas"
fnt = g.CreateFontIndirect(font)
g.SelectObject(dc,fnt)
g.SetBkColor(dc, a.RGB(0,0,0))

def get_cursor_pos():
cursor = wintypes.POINT()
r = byref(cursor)
windll.user32.GetCursorPos(r)
return (cursor.x, cursor.y)

dc = g.GetDC(0)
text = "Hello?"

while True:
(x,y) = get_cursor_pos()
g.DrawText(dc,
text,
len(text),
(x,y,x+40,y+40),
0)
time.sleep(1)

0 comments on commit 158696b

Please sign in to comment.