-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap_editor.pyw
688 lines (614 loc) · 24.9 KB
/
map_editor.pyw
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
from tkinter import *
from colours import *
import json, math, os
from PIL import ImageTk, Image
"""pip install pillow"""
#from interactables import *
root = Tk()
sidebar = Frame(root, width=400)
sidebar.pack(side="left", fill="both")
sidebar.config(bg=C2)
sidebar.pack_propagate(0)
mainframe = Frame(root, borderwidth=10)
mainframe.pack(side="left", fill="both", expand=True)
mainframe.config(bg=C1)
with open("data/info.json") as data:
info_file = json.load(data)
class InfoClass:
def __init__(self):
self.background = self.text_handler("background")
self.label = self.text_handler("label")
self.button = self.text_handler("button")
self.toggle = self.text_handler("toggle")
self.info = self.text_handler("info")
self.frame = self.text_handler("frame")
def text_handler(self, item):
text = info_file["InfoClass"][item]
if ":" in text:
for marker in text.split(":"):
if marker in info_file["InfoClass"]:
text = text.replace(f":{marker}:", info_file["InfoClass"][marker])
else:
pass
return text
def colours(self):
for category in info_file["Colours"]:
print(category)
if type(info_file["Colours"][category]) == dict:
for name, colour in info_file["Colours"][category].items():
print(f" {name} {colour}")
else:
for colour in info_file["Colours"][category]:
print(f" {colour}")
info = InfoClass()
def create_background(frame, side, fill, expand, bg, border=5, cursor=False):
if cursor:
background = Frame(frame, borderwidth=border, cursor="hand2")
else:
background = Frame(frame, borderwidth=border)
background.pack(side=side, fill=fill, expand=expand)
background.config(bg=bg)
return background
def text_handler(text):
#JL6079
"""
checks if ´text´is tuple
checks how many items are in ´text´
"""
#Two items
if type(text) == tuple and len(text) == 2:
#checks if 2nd item is an integer
if type(text[1]) == int:
text, size, state = text[0], text[1], NORMAL
else:
text, size, state = text[0], 10, text[1]
#Three items
elif type(text) == tuple and len(text) == 3:
text, size, state = text[0], text[1], text[2]
#One iem
else:
text, size, state = text, 10, NORMAL
return text, size, state
def create_label(frame, text, side="top", fill="both", expand=True, bg=C3, fg="white"):
text, size, state = text_handler(text)
label = Label(frame, text=text, state=state)
label.pack(side=side, fill=fill, expand=expand)
label.config(fg=fg, bg=bg)
label.config(height=2, font=("TkDefaultFont", size))
return label
def create_button(frame, text, side="top", fill="both", expand=False, bg=C3, fg="white"):
# Other
text, size, state = text_handler(text)
background = create_background(frame, side, fill, expand, bg)
# Main
button = Label(background, text=text, state=state, cursor="hand2")
button.pack(side=side, fill="both", expand=True)
button.config(bg=bg, fg=fg)
button.config(height=2, font=("TkDefaultFont", size))
button.bind("<Button-1>", lambda event: jump_point(text))
# Hover effect
button.bind("<Enter>", lambda event: background.config(bg=C4))
button.bind("<Leave>", lambda event: background.config(bg=bg))
return button
def create_toggle(frame, text, side="top", fill="both", expand=True):
# Other
text, size, state = text_handler(text)
background = create_background(frame, side, fill, expand, C3)
image_label = create_toggle_image(background, text, expand)
# Main
toggle = Label(background, text=text, state=state, cursor="hand2")
toggle.pack(side="right", fill="both", expand=True)
toggle.config(bg=C3, fg="white")
toggle.config(height=2, font=("TkDefaultFont", size))
toggle.bind("<Button-1>", lambda event: jump_point(f"Toggle {text}", image_label))
# Hover effect
toggle.bind("<Enter>", lambda event: background.config(bg=C4))
toggle.bind("<Leave>", lambda event: background.config(bg=C3))
return toggle
def create_toggle_image(background, text, expand, file="Toggle On.png"):
if expand:
frame = create_background(background, "right", "both", False, C3, 0, True)
frame.bind("<Button-1>", lambda event: jump_point(f"Toggle {text}", label))
frame.bind("<Enter>", lambda event: background.config(bg=C4))
frame.bind("<Leave>", lambda event: background.config(bg=C3))
else:
frame = background
# Main
label = Label(frame, image=image_handler(text, file), cursor="hand2")
label.pack(side="right", expand=False)
label.config(bg=C3)
# Binds
label.bind("<Button-1>", lambda event: jump_point(f"Toggle {text}", label))
label.bind("<Enter>", lambda event: background.config(bg=C4))
label.bind("<Leave>", lambda event: background.config(bg=C3))
return label
def image_handler(text, file, size=40, rotation=0):
# JL6079
image = Image.open(file).convert("RGBA").rotate(rotation)
image = image.resize((size, size), Image.Resampling.LANCZOS)
image = ImageTk.PhotoImage(image)
global images
images[text] = image
return images[text]
def toggle_handler(text):
global toggles
if text not in toggles:
toggles[text] = False
else:
toggles[text] = not toggles[text]
return toggles[text]
images = {}
toggles = {}
def create_frame(frame, side="top", fill="both", expand=True, border=0, bg=C2):
frame = Frame(frame, borderwidth=border)
frame.pack(side=side, fill=fill, expand=expand)
frame.config(bg=bg)
return frame
def create_row_old(bg="#323233", borderwidth=0):
frame = Frame(mainframe, borderwidth=borderwidth)
frame.pack(side="top", fill="both", expand=True)
frame.config(bg=bg)
return frame
def create_square_old(row, i, side="left"):
frame1 = Frame(row, borderwidth=5)
frame1.pack(side=side, fill="both", expand=True)
frame1.config(bg="#252526")
frame2 = Frame(frame1)
frame2.pack(side=side, fill="both", expand=True)
frame2.config(bg="#323233")
create_label(frame2, i)
def create_blocklist_old():
geometry = root.winfo_geometry()
print(geometry)
width = round(mainframe.winfo_width()/250)
height = round(mainframe.winfo_height()/250)
print(mainframe.winfo_width(), mainframe.winfo_height())
for row_i in range(height):
row = create_row()
for column_i in range(width):
create_square(row, f"{column_i}/{row_i}")
class Create:
def __init__(self, frame):
self.frame = frame
self.__loaded_images = {}
def create_column(self, frame):
column = Frame(frame, borderwidth=0)
column.pack(side="left", fill="both", expand=True)
column.config(bg=C2)
return column
def create_block(self, column, bg=C2, fg=C3):
# Outer
block_base = Frame(column, borderwidth=5)
block_base.pack(side="top", fill="both", expand=True)
block_base.config(bg=bg)
# Inner
block = Frame(block_base)
block.pack(side="top", fill="both", expand=True)
block.config(bg=fg)
block.pack_propagate(0)
return block_base, block
def get_image(self, file_name, size=90):
if file_name in self.__loaded_images:
return self.__loaded_images[file_name]
else:
image = image_handler(file_name, f"textures/{file_name}", 90)
self.__loaded_images[file_name] = image
return image
class Blocklist(Create):
def __init__(self, frame, items, debug=False):
super().__init__(frame)
self.items = items
#self.include_plus_button = plus_button
#self.has_plus_button =
self.debug = debug
#self.columns = round(frame.winfo_width()/250)
#self.rows = round(frame.winfo_height()/250)
self.columns = 9
self.rows = 6
self.block_locations = {}
self.current_highlight = None
self.current_level_id = None
self.create_grid(frame, len(items))
def create_grid(self, frame, blocks):
full_rows = math.floor(blocks/self.columns)
extra_blocks = blocks % self.columns
if self.debug:
print(full_rows, extra_blocks)
include_plus_button = True
for column_id in range(self.columns):
column = super().create_column(frame)
# Calculate blocks
plus_button = False
blocks = full_rows
if column_id < extra_blocks:
blocks += 1
elif include_plus_button:
plus_button = True
include_plus_button = False
# Create blocks
self.create_blocks(column, column_id, blocks, plus_button)
self.change_highlight(self.current_highlight)
def create_blocks(self, column, column_id, active_blocks, plus_button):
for row_id in range(self.rows):
if not row_id >= active_blocks:
ordinal_num = self.columns * row_id + column_id
self.create_true(column, f"{column_id}/{row_id}", ordinal_num)
elif plus_button:
self.create_plus_button(column, f"{column_id}/{row_id}")
plus_button = False
else:
self.create_false(column, f"{column_id}/{row_id}")
def create_true(self, column, block_id, ordinal_num):
"""Create a light block"""
# Base
block_base, block = self.create_block(column)
# Main
text = f"Level {ordinal_num + 1}"
if check_map(ordinal_num + 1):
self.create_button(block, text, block_base, fg="gray")
else:
self.create_button(block, text, block_base, fg="white")
# Other
self.block_locations[text] = block_id
# Debug
if self.debug:
create_label(block, self.items[ordinal_num])
create_label(block, ordinal_num)
create_label(block, block_id, "bottom", "both", False)
def create_false(self, column, block_id):
"""Create a dark block"""
# Base
block = self.create_block(column, C1, C1)[1]
# Other
self.block_locations[block_id] = False
# Debug
if self.debug:
create_label(block, block_id, bg=C1, fg="lightgray")
def create_plus_button(self, column, block_id):
# Base
block_base, block = self.create_block(column, C1, C1)
# Main
image = image_handler("+", "icons/Disabled.png", 125, 45)
label = Label(block, image=images["+"], cursor="hand2", bg=C1)
label.pack(side="top", fill="both", expand=True)
label.bind("<Button-1>", lambda event: self.plus_function())
label.bind("<Enter>", lambda event: block_base.config(bg=C4))
label.bind("<Leave>", lambda event: block_base.config(bg=C1))
# Other
self.block_locations["+"] = block_id
def plus_function(self):
new_map()
self.refresh(True)
def create_button(self, frame, text, block_base, fg="white"):
# Base
background = create_background(frame, "top", "both", True, C3)
# Main
button = Label(background, text=text, cursor="hand2")
button.pack(side="top", fill="both", expand=True)
button.config(bg=C3, fg=fg)
button.config(height=2, font=("TkDefaultFont", 15))
button.bind("<Button-1>", lambda event: self.jump_point(text, block_base))
# Hover effect
button.bind("<Enter>", lambda event: background.config(bg=C4))
button.bind("<Leave>", lambda event: background.config(bg=C3))
return button
def jump_point(self, text, block_base):
"""Custom Blocklist jump point"""
block_id = self.block_locations[text]
# Toggle selection
if block_id == self.current_highlight:
self.deselect_block()
return
# Current level
self.current_level_id = int(text.split()[1])
# Change highlight
self.block_highlight(block_id)
# Jump point
jump_point(text)
def block_highlight(self, new_block_id):
"""Block highlight handler"""
# Check for active highlight
if self.current_highlight:
# Remove old highlight
block_id = self.current_highlight
self.change_highlight(block_id, C2)
# Highlight new block
self.change_highlight(new_block_id, C4)
self.current_highlight = new_block_id
def change_highlight(self, block_id, bg=C4):
if not block_id:
return
column_id, row_id = list(map(int, block_id.split("/")))
column = self.frame.slaves()[column_id]
block = column.slaves()[row_id]
block.config(bg=bg)
def deselect_block(self):
self.change_highlight(self.current_highlight, C2)
self.current_highlight = None
self.current_level_id = None
switch_sidebar("Mainmenu")
def refresh(self, keep_highlight=False):
for item in self.frame.slaves():
item.destroy()
if not keep_highlight:
self.current_highlight = None
self.items = list_maps()
self.create_grid(self.frame, len(self.items))
class CreateMap(Create):
def __init__(self, frame, level_id):
super().__init__(frame)
self.level_id = int(level_id)
self.paint_type = "None"
self.map_data = self.load_data()["Map"]
self.load_map()
def load_map(self):
for column_id, column_data in enumerate(self.map_data):
column = super().create_column(self.frame)
for row_id, row_data in enumerate(column_data):
block = self.create_block(column, C2)
self.colour_match(row_data, f"{column_id}/{row_id}", block)
def load_data(self):
file_name = list_maps()[self.level_id - 1]
with open(f"maps/{file_name}") as data:
data = json.load(data)
return data
def create_block(self, column, bg):
block_base = Frame(column, borderwidth=5)
block_base.pack(side="top", fill="both", expand=True)
block_base.config(bg=bg)
block_base.pack_propagate(0)
return block_base
def change_colour(self, column_id, row_id):
column = mainframe.slaves()[column_id]
block = column.slaves()[row_id]
clear_frame(block)
self.colour_match(self.paint_type, f"{column_id}/{row_id}", block)
def colour_match(self, block_type, block_id, block):
match block_type:
case "None":
block.config(bg=C2)
create_button(block, block_id, expand=True, fg=C3)
case "Hole":
block.config(bg=C1)
create_button(block, block_id, expand=True, bg=C1, fg=C1)
case "Wall":
block.config(bg=C6)
create_button(block, block_id, expand=True, fg=C3)
case "Player":
block.config(bg=C2)
self.image_button(block, block_id, "ghost.png", 160)
case "Enemy":
block.config(bg=C2)
self.image_button(block, block_id, "pahis.png")
case "Apple":
block.config(bg=C2)
#create_button(block, block_id, expand=True, bg=C7, fg=C7)
self.image_button(block, block_id, "apple.png", 90)
case "Banana":
block.config(bg=C2)
self.image_button(block, block_id, "banana.png", 90)
case "Coin":
block.config(bg=C2)
self.image_button(block, block_id, "kolikke.png", 90)
case "Next level":
block.config(bg=C2)
self.image_button(block, block_id, "door.png", 160)
case _:
block.config(bg="#f847f5")
create_button(block, block_id, expand=True, bg="black", fg="#f847f5")
def image_button(self, frame, block_id, file_name, size=120):
#size = round(mainframe.winfo_height()/10)
## image_handler(block_id, f"textures/{file_name}", size)
## button = Label(frame, image=images[block_id], cursor="hand2", bg=C3)
image = self.get_image(file_name)
button = Label(frame, image=image, cursor="hand2", bg=C3)
button.pack(side="top", fill="both", expand=True)
button.bind("<Button-1>", lambda event: jump_point(block_id))
def clear_map(self):
for column_id, column_data in enumerate(self.map_data):
for row_id, block_type in enumerate(column_data):
if block_type != "None":
self.map_data[column_id][row_id] = "None"
clear_frame(self.frame)
self.load_map()
class CreateToolbar(Create):
def __init__(self, frame):
super().__init__(frame)
self.paint_label = None
self.create()
def create(self):
self.frame = create_frame(self.frame)
self.info_panel()
create_label(self.frame, "", expand=False, bg=C2)
self.paint_selector()
create_label(self.frame, "", expand=False, bg=C2)
create_button(self.frame, ("Clear map", 15))
def info_panel(self):
create_label(self.frame, ("Info", 15), expand=False)
frame = create_frame(self.frame, expand=False)
create_label(frame, f"Apples: {self.object_count('Apple')}", "left", expand=True)
create_label(frame, f"Bananas: {self.object_count('Banana')}", "left", expand=True)
create_label(frame, f"Coins: {self.object_count('Coin')}", "left", expand=True)
def paint_selector(self):
self.paint_label = create_label(self.frame, ("Selected paint: None", 15), expand=False)
frame = create_frame(self.frame, expand=False)
self.create_button(frame, "None", "left", True)
self.create_button(frame, "Hole", "left", True)
self.create_button(frame, "Wall", "left", True)
frame = create_frame(self.frame, expand=False)
self.create_button(frame, "Player", "left", True)
self.create_button(frame, "Enemy", "left", True)
frame = create_frame(self.frame, expand=False)
self.create_button(frame, "Apple", "left", True)
self.create_button(frame, "Banana", "left", True)
self.create_button(frame, "Coin", "left", True)
frame = create_frame(self.frame, expand=False)
self.create_button(frame, "Next level", "left", True)
def create_button(self, frame, text, side="top", expand=False):
# Other
text, size, state = text_handler(text)
background = create_background(frame, side, "both", expand, C3)
# Main
button = Label(background, text=text, state=state, cursor="hand2")
button.pack(side=side, fill="both", expand=True)
button.config(bg=C3, fg="white")
button.config(height=2, font=("TkDefaultFont", size))
button.bind("<Button-1>", lambda event: self.jump_point(text))
# Hover effect
button.bind("<Enter>", lambda event: background.config(bg=C4))
button.bind("<Leave>", lambda event: background.config(bg=C3))
return button
def jump_point(self, paint_type):
mapgrid.paint_type = paint_type
self.paint_label.config(text=f"Selected paint: {paint_type}")
def object_count(self, block_type):
block_count = 0
for column_data in mapgrid.map_data:
block_count += column_data.count(block_type)
return block_count
def multiple(obj_type, amount, frame=True):
if frame:
frame = mainframe
items = []
for i in range(amount):
items.append(obj_type(frame))
return items
def list_maps():
maps = []
for path, folders, files in os.walk("maps"):
for file in files:
if "template" in file:
continue
maps.append(file)
maps.sort(key=lambda f: int(''.join(filter(str.isdigit, f))))
return maps
def new_map():
# JL6079
map_id = int(list_maps()[-1].strip("level_.json"))+1
print(f"creating new map file level_{map_id}.json")
with open("maps/map_template.json") as data:
data = json.load(data)
with open(f"maps/level_{map_id}.json", "w") as file:
json.dump(data, file, indent=4)
def check_map(level_id):
file_name = list_maps()[level_id - 1]
with open(f"maps/{file_name}") as data:
map_data = json.load(data)["Map"]
for column_data in map_data:
if not len(column_data) == column_data.count("None"):
return False
return True
"""
START
"""
def startup():
switch_frame("Mainmenu")
def jump_point(text, toggle=False):
text = text.replace("/", " id ")
match text.split():
#match re.split(" |/", text):
case ["Quit"]:
quit()
case ["Refresh"]:
maplist.refresh()
switch_sidebar("Mainmenu")
case ["Switch", "to", "game"]:
os.startfile("game.pyw")
jump_point("Quit")
case ["Back"]:
switch_frame("Mainmenu")
case ["Level", level_id]:
switch_sidebar("Level info", int(level_id))
case ["Load", "map"]:
level_id = sidebar.slaves()[1].cget("text").split()[1]
switch_frame("Load map", level_id)
case ["Delete", "map"]:
file_name = list_maps()[maplist.current_level_id - 1]
os.remove(f"maps/{file_name}")
jump_point("Refresh")
case [column, "id", row]:
print(f"{column}/{row}")
column, row = int(column), int(row)
mapgrid.change_colour(column, row)
mapgrid.map_data[column][row] = mapgrid.paint_type
case ["Clear", "map"]:
mapgrid.clear_map()
case ["Save", "changes"]:
file_name = list_maps()[mapgrid.level_id - 1]
with open(f"maps/{file_name}", "w") as file:
json.dump({"Map": mapgrid.map_data}, file, indent=4)
case ["Toggle", *text]:
text = " ".join(text)
state = toggle_handler(text)
if state:
image = image_handler(text, "Toggle On.png")
else:
image = image_handler(text, "Toggle Off.png")
toggle.configure(image=image)
case _:
print(text)
switch_frame(text)
def switch_frame(frame, level_id=False):
clear_frame(mainframe)
if frame == "Mainmenu":
global maplist
maplist = Blocklist(mainframe, list_maps())
switch_sidebar(frame)
elif frame == "Load map":
global mapgrid
mapgrid = CreateMap(mainframe, level_id)
switch_sidebar(frame, level_id)
def switch_sidebar(frame, level_id=False):
clear_frame(sidebar)
if frame == "Mainmenu":
create_label(sidebar, ("Level info", 20), expand=False, bg=C2)
create_label(sidebar, "Click on a map to continue", bg=C2)
create_button(sidebar, ("Switch to game", 15), "bottom")
create_button(sidebar, ("Quit", 15), "left", expand=True)
create_button(sidebar, ("Refresh", 15), "left", expand=True)
elif frame == "Level info":
create_label(sidebar, ("Level info", 20), expand=False, bg=C2)
create_label(sidebar, (f"Level {level_id}", 15), expand=False, bg=C2)
create_label(sidebar, "", bg=C2)
map_size, high_score = load_map_info(level_id)
create_label(sidebar, (f"Map size: {map_size}", 13))
create_label(sidebar, (f"High score: {high_score}", 13))
create_label(sidebar, "", bg=C2)
create_button(sidebar, ("Load map", 15))
create_button(sidebar, ("Delete map", 15))
create_button(sidebar, ("Switch to game", 15), "bottom")
create_button(sidebar, ("Quit", 15), "left", expand=True)
create_button(sidebar, ("Refresh", 15), "left", expand=True)
elif frame == "Load map":
create_label(sidebar, ("Level info", 20), expand=False, bg=C2)
create_label(sidebar, (f"Level {level_id}", 15), expand=False, bg=C2)
create_label(sidebar, "", bg=C2)
CreateToolbar(sidebar)
create_label(sidebar, "", bg=C2)
create_button(sidebar, ("Save changes", 15))
create_button(sidebar, ("Back", 15))
def load_map_info(level_id):
file_name = list_maps()[level_id - 1]
with open(f"maps/{file_name}") as data:
data = json.load(data)
map_size = f"{len(data['Map'])}x{len(data['Map'][0])}"
with open(f"data/saved_data.json") as data:
data = json.load(data)
try:
high_score = data[f"Level {level_id}"]["score"]
except KeyError:
high_score = 0
return map_size, high_score
def clear_frame(*frames):
for frame in frames:
for item in frame.slaves():
item.destroy()
root.bind("<Escape>", quit) #sys.exit
root.iconbitmap("icons/blume.ico")
root.title("Petri-man : Level editor")
#root.geometry("1000x600+100+100")
#root.minsize(250, 200)
root.state('zoomed')
#root.attributes('-fullscreen', True)
root.after(6, startup)
root.mainloop()