-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_start.py
executable file
·97 lines (77 loc) · 2.89 KB
/
edit_start.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
import tkinter
from edit_tab_files import FilesTab
from edit_tab_level import LevelTab
from pacworms_global import CONST, VAR
from extra_widgets import MyButton
class StartEdit:
def __init__(self, master):
"""
:param master:
"""
#
# save master
#
self.master = master
# self.frame = tkinter.Frame(self.master)
#
# init. window editor
#
tkinter.Tk.wm_title(self.master, "Toplevel Window Editor")
tkinter.Tk.geometry(self.master, "%dx%d%+d%+d" %
(CONST.WindowEditorSize.width, CONST.WindowEditorSize.height, 340, 200))
tkinter.Tk.config(self.master, background=CONST.WidgetsColor.frame_tabs, pady=2)
tkinter.Tk.columnconfigure(self.master, 0, weight=1)
tkinter.Tk.rowconfigure(self.master, 1, weight=1)
#
# frames bars left and right -> GRID(0, 0)
#
frame_bar_left = tkinter.Frame(self.master, background=CONST.WidgetsColor.frame_tabs)
frame_bar_right = tkinter.Frame(self.master, background=CONST.WidgetsColor.frame_tabs)
frame_bar_left.grid(column=0, row=0, padx=2, pady=0, sticky="nsw")
frame_bar_right.grid(column=0, row=0, padx=2, pady=0, sticky="nse")
#
# lefts buttons
#
self.button_files = MyButton(frame_bar_left, "FILES")
self.button_level = MyButton(frame_bar_left, "LEVELS")
self.button_files.config(command=lambda: self.action_button_files())
self.button_level.config(command=lambda: self.action_button_level())
self.button_files.grid(column=0, row=0, padx=2, pady=1)
self.button_level.grid(column=1, row=0, padx=2, pady=1)
#
# rights buttons
#
self.button_quit_editor = MyButton(frame_bar_right, "QUIT\nEDITOR")
self.button_quit_editor.config(command=lambda: self.action_button_quit())
self.button_quit_editor.grid(column=0, row=0, padx=2, pady=1)
#
# frames files and level -> GRID(0, 1)
#
self.tab_files = FilesTab(self.master)
self.tab_files.grid(column=0, row=1, padx=1, pady=1, sticky="nsew")
self.tab_level = LevelTab(self.master)
self.tab_level.grid(column=0, row=1, padx=1, pady=1, sticky="nsew")
#
# par defaut frame tab files
#
self.action_button_files()
def action_button_quit(self):
"""
:return:
"""
VAR.Windows.editor = False
tkinter.Tk.destroy(self.master)
def action_button_files(self):
"""
:return:
"""
self.tab_files.tkraise()
self.button_level.set_state(0)
self.button_files.set_state(1)
def action_button_level(self):
"""
:return:
"""
self.tab_level.tkraise()
self.button_files.set_state(0)
self.button_level.set_state(1)