-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.py
More file actions
97 lines (92 loc) · 2.45 KB
/
App.py
File metadata and controls
97 lines (92 loc) · 2.45 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import pygame as pg
from func import *
class Main:
def __init__(self):
self.menu = Menu()
self.page = Page()
self.exit = Exit()
self.shape = Shapes()
#-----------------
self.draw_rect=False
self.draw_circle = False
self.draw_box = False
self.draw_Tri = False
#
self.intro = False
self.drag =False
self.select = False
self.run = True
self.is_dragging = False
#_________________________
def check_events(self):
#__Method variables
self.pos = pg.mouse.get_pos()
for i in pg.event.get():
if i.type == pg.QUIT:
self.run = False
#__OTHER BUTTONS ____##
if i.type == pg.MOUSEBUTTONDOWN:
self.pos
exit(self.pos,self.run)
#___MENU AND CONTROLS _____ ##
#For btn1
if self.menu.btn1.collidepoint(self.pos):
self.draw_box= True
#For Butn2
if self.menu.btn2.collidepoint(self.pos):
print("btn2")
self.draw_circle = True
# For btn3
if self.menu.btn3.collidepoint(self.pos):
print("btn3")
self.draw_Tri = True
#______________________
#__ELEMENTS CONTRLING LOGIC
#__ FOR Deselection_ #
if i.type == pg.MOUSEBUTTONUP:
self.is_dragging = False
self.move_circle = False
self.move_box = False
self.move_tri = False
#__ FOR Selection _____#
if i.type == pg.MOUSEBUTTONDOWN:
self.pos
if self.shape.circle.rect.collidepoint(self.pos):
self.is_dragging = True
self.move_circle = True
if i.type == pg.MOUSEBUTTONDOWN:
self.pos
if self.shape.box.box.collidepoint(self.pos):
self.is_dragging = True
self.move_box = True
if i.type == pg.MOUSEBUTTONDOWN:
self.pos
if self.shape.tri.rect.collidepoint(self.pos):
self.is_dragging = True
self.move_tri= True
#_______________________
# __ FOR DRAGGING ELEMENTS ___ #
if self.is_dragging and self.move_circle:
if i.type == pg.MOUSEMOTION:
self.shape.circle.rect.center = self.pos
if self.is_dragging and self.move_box:
if i.type == pg.MOUSEMOTION:
self.shape.box.box.center = self.pos
if self.is_dragging and self.move_tri:
if i.type == pg.MOUSEMOTION:
self.shape.tri.rect.center = self.pos
def draw(self):
win.fill(GREY)
self.page.draw()
self.menu.draw()
Show_pos()
self.exit.draw()
if self.draw_Tri:
self.shape.tri.draw()
if self.draw_circle:
self.shape.circle.draw()
if self.draw_box:
self.shape.box.draw()
def update(self):
print(clock.get_fps())
pg.display.update(),clock.tick(fps)