-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_tab_level.py
executable file
·149 lines (120 loc) · 4.59 KB
/
edit_tab_level.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import tkinter
from extra_widgets import MyButton
from pacworms_global import CONST, VAR
from edit_frame_walls import WallsFrame
from edit_frame_gallery import GalleryFrame
from edit_frame_worms import WormsFrame
from edit_frame_gums import GumsFrame
class LevelTab(tkinter.Frame):
def __init__(self, parent):
"""
:param parent:
"""
tkinter.Frame.__init__(self, parent)
self.parent = parent
self.configure(background=CONST.WidgetsColor.frame_level_buttons)
#
# centrer les cadres walls, galleries, worms, gums -> GRID(0, 0)
#
self.columnconfigure(0, weight=1)
self.rowconfigure(1, weight=1)
#
# frames bars left and right -> GRID(0, 0)
#
frame_bar_left = tkinter.Frame(self, background=CONST.WidgetsColor.frame_level_buttons)
frame_bar_right = tkinter.Frame(self, background=CONST.WidgetsColor.frame_level_buttons)
frame_bar_left.grid(column=0, row=0, padx=1, pady=0, sticky="nsw")
frame_bar_right.grid(column=0, row=0, padx=1, pady=0, sticky="nse")
#
# lefts buttons
#
self.button_walls = MyButton(frame_bar_left, "WALLS")
self.button_gallery = MyButton(frame_bar_left, "GALLERIES")
self.button_worms = MyButton(frame_bar_left, "WORMS")
self.button_gums = MyButton(frame_bar_left, "GUMS")
self.button_walls.config(command=lambda: self.action_button_walls())
self.button_gallery.config(command=lambda: self.action_button_gallery())
self.button_worms.config(command=lambda: self.action_button_worms())
self.button_gums.config(command=lambda: self.action_button_gums())
self.button_walls.grid(column=0, row=0, padx=2, pady=1)
self.button_gallery.grid(column=1, row=0, padx=2, pady=1)
self.button_worms.grid(column=2, row=0, padx=2, pady=1)
self.button_gums.grid(column=3, row=0, padx=2, pady=1)
#
# rights buttons
#
self.button_test = MyButton(frame_bar_right, "TEST\nLEVEL")
self.button_save = MyButton(frame_bar_right, "SAVE\nLEVEL")
self.button_clear = MyButton(frame_bar_right, "CLEAR\nLEVEL")
self.button_test.config(command=lambda: self.action_button_test())
self.button_save.config(command=lambda: self.action_button_save())
self.button_clear.config(command=lambda: self.action_button_clear())
self.button_test.grid(column=0, row=0, padx=2, pady=1)
self.button_save.grid(column=1, row=0, padx=2, pady=1)
self.button_clear.grid(column=2, row=0, padx=2, pady=1)
#
# frames walls, gallery, worms, gums -> GRID(0, 1)
#
self.walls_frame = WallsFrame(self)
self.gallery_frame = GalleryFrame(self)
self.worms_frame = WormsFrame(self)
self.gums_frame = GumsFrame(self)
self.walls_frame.grid(column=0, row=1, padx=3, pady=1, sticky="nsew")
self.gallery_frame.grid(column=0, row=1, padx=3, pady=1, sticky="nsew")
self.worms_frame.grid(column=0, row=1, padx=3, pady=1, sticky="nsew")
self.gums_frame.grid(column=0, row=1, padx=3, pady=1, sticky="nsew")
#
# par defaut walls button
#
self.action_button_walls()
def action_button_walls(self):
"""
:return:
"""
self.walls_frame.tkraise()
self.button_gallery.set_state(0)
self.button_worms.set_state(0)
self.button_gums.set_state(0)
self.button_walls.set_state(1)
def action_button_gallery(self):
"""
:return:
"""
self.gallery_frame.tkraise()
self.button_walls.set_state(0)
self.button_worms.set_state(0)
self.button_gums.set_state(0)
self.button_gallery.set_state(1)
def action_button_worms(self):
"""
:return:
"""
self.worms_frame.tkraise()
self.button_walls.set_state(0)
self.button_gallery.set_state(0)
self.button_gums.set_state(0)
self.button_worms.set_state(1)
def action_button_gums(self):
"""
:return:
"""
self.gums_frame.tkraise()
self.button_walls.set_state(0)
self.button_gallery.set_state(0)
self.button_worms.set_state(0)
self.button_gums.set_state(1)
def action_button_test(self):
"""
:return:
"""
VAR.levels.walls.show_foreground()
def action_button_save(self):
"""
:return:
"""
pass
def action_button_clear(self):
"""
:return:
"""
pass