-
Notifications
You must be signed in to change notification settings - Fork 0
/
gzeg.py
52 lines (39 loc) · 1.17 KB
/
gzeg.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
from listelvl import *
from ezTK import *
import time
import random
def test():
list = level_list() #gives a list of strings for all the levels
a = random.randint(1,5)
maxcols = 0
col = 0
rows = 0
count = 0
for i in list[a]: #count rows and cols
if i.endswith('\n'):
rows +=1
maxcols = max(col,maxcols)
col = 0
else: col+=1
print(maxcols)
print(rows)
del win[0]
global fram
fram = Frame(win, fold=maxcols, grow = False)
images = tuple(Image(file= f'{status}.gif') for status in 'ABCDEFG') # store cell images in a tuple
# ----------------------------------------------------------------------------
blocks = {' ': 0, '.': 1, '$': 2, '*':3, '@': 4, '+': 5, '#': 6}
for loop in range(len(list[a])): # loop over the list to create cells
letter = list[a][count]
if letter in blocks:
Label(fram, image=images, state =blocks[letter], grow=False)
count +=1
win.after(3000,test)
win.loop()
def main():
global win
win = Win(title='test', bg='#000', grow = False)
Frame(win)
test()
if __name__ == '__main__':
main()