-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindow.py
More file actions
28 lines (22 loc) · 777 Bytes
/
Copy pathwindow.py
File metadata and controls
28 lines (22 loc) · 777 Bytes
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
from tkinter import Tk, Canvas
class Window:
def __init__(self, width, height):
self.width = width
self.height = height
self.__root = Tk()
self.__root.title("Main Window")
self.canvas = Canvas(self.__root, width=self.width, height=self.height)
self.canvas.pack()
self.window_running = False
def redraw(self):
self.__root.update_idletasks()
self.__root.update()
def draw_line(self, line, fill_color):
line.draw(self.canvas, fill_color)
def wait_for_close(self):
self.window_running = True
while self.window_running:
self.redraw()
def close(self):
self.window_running = False
self.__root.protocol("WM_DELETE_WINDOW", self.close)