-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
47 lines (26 loc) · 1.14 KB
/
main.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
import Convert
import camera
import customtkinter as ctk
import tkinter as tk
class Main:
def __init__(self):
self.WINDOW = ctk.CTk(fg_color="black")
self.WINDOW.title("ASCII")
self.CAMERA = camera.Camera()
self.DELAY = 16
self.SIZE = [100, 36] #Size of ASCII text
#GUI
self.text_widget = ctk.ctk_tk.tkinter.Text(self.WINDOW, wrap=tk.WORD,
height=self.SIZE[1], width=self.SIZE[0],
bg="black", fg="white")
self.text_widget.grid(row=0, column=1, padx=20, pady=20)
self.WINDOW.attributes("-topmost", True)
self.Update()
self.WINDOW.mainloop()
def Update(self):
stanje, self.picture = self.CAMERA.Get_Image() # Gets the current frame
self.text_widget.delete(1.0, tk.END) # deletes previus ASCII image
self.text_widget.insert(1.0, Convert.start(self.picture, W=self.SIZE[0])) #ASCII image
self.WINDOW.after(self.DELAY, self.Update) #Updates
if __name__ == "__main__":
Main()