-
Notifications
You must be signed in to change notification settings - Fork 3
/
opencvapp.py
72 lines (55 loc) · 1.93 KB
/
opencvapp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import pygame, sys
import random
from Test import wordtest
from Sentence import sentence
from Phrase import phrasetest
pygame.init()
screen = pygame.display.set_mode((800, 600))
#icon = pygame.image.load("Assets\\SignSense.jpeg")
def mainmenu():
image = pygame.image.load("Assets\\sign.png")
image2 = pygame.image.load("Assets\\phrase.png")
imageold = image
image2old = image2
background = pygame.image.load("assets\\SignSense.png")
font = pygame.font.Font("freesansbold.ttf", 24)
pygame.display.set_caption("Sign Sense")
click = False
button1 = pygame.Rect(450, 250, 200, 75)
str1 = ""
button2 = pygame.Rect(450, 450, 200, 75)
while True:
screen.fill((0, 0, 0))
screen.blit(background, (0, 0))
mx, my = pygame.mouse.get_pos()
click = False
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
click = True
if button1.collidepoint((mx, my)):
imagenew = pygame.transform.scale(image, (215, 90))
image = imagenew
if click:
str1 = wordtest()
sentence(str1)
if button2.collidepoint((mx, my)):
image2new = pygame.transform.scale(image2, (215, 90))
image2 = image2new
if click:
str1 = phrasetest.phrase()
sentence(str1)
screen.blit(image, button1)
screen.blit(image2, button2)
#screen.blit(image3, button3)
image = imageold
image2 = image2old
#image3 = image3old
# pygame.draw.rect(screen, (255,255,255), button1)
# pygame.draw.rect(screen, (255, 255, 255), button2)
# pygame.draw.rect(screen, (255, 255, 255), button3)
pygame.display.update()
mainmenu()