-
Notifications
You must be signed in to change notification settings - Fork 0
/
open_letter.py
57 lines (44 loc) · 1.55 KB
/
open_letter.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
import pygame
import sys, os
def resource_path(relative_path):
""" Get the absolute path to the resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
class MainScreen():
def __init__(self,screen_size):
self.screen = pygame.display.set_mode(screen_size,pygame.RESIZABLE,0,32)
self.bg_img = pygame.image.load(resource_path('figures/0_1_you_have_mail.png'))
def initial_setup(self):
pygame.display.update()
self.screen.blit(self.bg_img, (0,0))
def check_mail(self,event):
mx, my = pygame.mouse.get_pos()
if mx > 108 and mx < 291 and my > 128 and my < 241:
return True
else:
return False
def main_letter():
"""Main function for the
"""
screen_size = [400,283]
pygame.init()
pygame.display.set_caption('Tienes correo')
screen = MainScreen(screen_size)
running = True
while running:
screen.initial_setup()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.display.quit()
exit()
if event.type == pygame.MOUSEBUTTONDOWN:
status = screen.check_mail(event)
if status:
running = False
pygame.display.quit()
# main_letter()