-
Notifications
You must be signed in to change notification settings - Fork 0
/
drawWindow.py
60 lines (51 loc) · 1.54 KB
/
drawWindow.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
import sys
import csv
from tkinter import Tk, Canvas, Frame, BOTH, Button
arr = []
class Example(Frame):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.master.title("MazeCraze")
self.pack(fill=BOTH, expand=1)
canvas = Canvas(self)
with open('C:/Users/gusta/OneDrive/Documents/Plenissalen/mazeCraze/maze.csv') as f:
reader = csv.reader(f)
your_list = list(reader)
rowCounter = 0
xAxis = 0;
yAxis = 0;
size = 33;
array = your_list
for i in array:
minor = i
for x in minor:
print(x)
if x == '1':
color = 'gray15'
elif x == '3':
color = 'red'
else:
color = 'white'
if rowCounter == size:
yAxis += 10
rowCounter = 0
xAxis=0
rectangle = canvas.create_rectangle(xAxis, yAxis, xAxis+10, yAxis+10, outline=color, fill=color, width=2)
arr.append(rectangle)
xAxis += 10
rowCounter += 1
canvas.pack(fill=BOTH, expand=1)
button = Button(self, text='Solve', command=printHello)
button.pack(fill=BOTH, expand=1)
def printHello():
print('Hello')
def main():
root = Tk()
ex = Example()
root.geometry("330x220+300+300")
root.mainloop()
if __name__ == '__main__':
main()
a = str(sys.argv[1])