Skip to content

Commit f9b29fa

Browse files
committed
Update main.py
1 parent 66f6998 commit f9b29fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from time import sleep
55
import numpy as np
66
import cvzone
7+
from pynput.keyboard import Controller
78

89
cap = cv2.VideoCapture(0)
910
cap.set(3, 1280)
@@ -15,6 +16,7 @@
1516
["Z", "X", "C", "V", "B", "N", "M", ",", ".", "/"],
1617
["<", " "]]
1718
finalText = ""
19+
keyboard = Controller()
1820

1921
def drawALL(img, buttonList):
2022
imgNew = np.zeros_like(img, np.uint8)
@@ -65,8 +67,10 @@ def __init__(self, pos, text, size=[85, 85]):
6567
cv2.putText(img, button.text, (x + 20, y + 65), cv2.FONT_HERSHEY_PLAIN, 4, (255, 255, 255), 4)
6668
if button.text == "<":
6769
finalText = finalText[:-1]
70+
keyboard.press(button.text)
6871
else:
6972
finalText += button.text
73+
keyboard.press(button.text)
7074
sleep(0.15)
7175

7276
cv2.rectangle(img, (50, 710), (700, 610), (175, 0, 175), cv2.FILLED)

0 commit comments

Comments
 (0)