Skip to content

Commit

Permalink
custom tkinter
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamThyer committed Feb 23, 2023
1 parent 353d275 commit b04b99c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import tkinter as tk
import customtkinter as ctk
ctk.set_appearance_mode('dark')

import cv2
import PIL.Image as Image, PIL.ImageTk as ImageTk
import time
Expand Down Expand Up @@ -34,7 +37,8 @@ def __init__(self, dummy=False):
self.model = None
self.run_preds = True
self.show_webcam = True
self.hz = 2
self.hz = 1
self.pred_wait = int(1000/self.hz)
self.max_time = 60
self.dummy = dummy
if dummy:
Expand All @@ -54,7 +58,7 @@ def start(self):
self.predict()

def create_window(self):
self.window = tk.Tk()
self.window = ctk.CTk()
self.window.title("Calm Hands")
self.window.resizable(100,100)
self.window.configure(background='black')
Expand Down Expand Up @@ -99,7 +103,7 @@ def predict(self):
else:
pred_str = "Paused"

self.window.after(500, self.predict)
self.window.after(self.pred_wait, self.predict)

# VIDEO STUFF
def create_video(self):
Expand Down Expand Up @@ -190,11 +194,11 @@ def create_plot(self):

# BUTTONS
def create_show_vid_button(self):
self.show_vid_button = tk.Button(self.window, text="Show/Hide Video", command=self.switch_show_webcam)
self.show_vid_button = ctk.CTkButton(self.window, text="Show/Hide Video", command=self.switch_show_webcam)
self.show_vid_button.grid(row=2, column=0, padx=10, pady=2)

def create_run_preds_button(self):
self.preds_button = tk.Button(self.window, text="Play/Pause Predictions", command=self.switch_run_preds)
self.preds_button = ctk.CTkButton(self.window, text="Play/Pause Predictions", command=self.switch_run_preds)
self.preds_button.grid(row=2, column=1, padx=10, pady=2)

def switch_run_preds(self):
Expand Down

0 comments on commit b04b99c

Please sign in to comment.