-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
100 lines (79 loc) · 3.14 KB
/
app.py
File metadata and controls
100 lines (79 loc) · 3.14 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import customtkinter as ctk
from tabs import Tabs
class DetectoBuddyApp(ctk.CTk):
""" """
def __init__(self):
super().__init__()
# Set window title and disable resizing
self.title("DetectoBuddy v0.1.0")
self.resizable(False, False)
# Create tab view
self.tab_view = Tabs(master=self, width=800, height=600, app=self)
self.tab_view.grid(row=0, column=0, padx=20, pady=20)
# Initialize Image and Video tab elements
self.initialize_image_tab_elements()
self.initialize_video_tab_elements()
def initialize_image_tab_elements(self):
""" """
self.image_path_header = ctk.CTkLabel(
master=self.tab_view.tab("Image"), text="", font=("Arial", 20))
self.image_path_header.place(relx=0.5, rely=0.6, anchor="center")
self.image_error_path_header = ctk.CTkLabel(
master=self.tab_view.tab("Image"),
text="",
font=("Arial", 20),
text_color="red",
)
self.image_error_path_header.place(relx=0.5, rely=0.6, anchor="center")
self.image_path = ctk.CTkLabel(master=self.tab_view.tab("Image"),
text="",
font=("Arial", 15))
self.image_path.place(relx=0.5, rely=0.65, anchor="center")
self.image_detect_button = ctk.CTkButton(
master=self.tab_view.tab("Image"),
text="Detect now",
font=("Arial", 30),
command=lambda: self.image_detection(),
width=150,
height=18,
corner_radius=10,
)
self.image_detect_button.place_forget()
def initialize_video_tab_elements(self):
""" """
self.video_path_header = ctk.CTkLabel(
master=self.tab_view.tab("Video"), text="", font=("Arial", 20))
self.video_path_header.place(relx=0.5, rely=0.6, anchor="center")
self.video_error_path_header = ctk.CTkLabel(
master=self.tab_view.tab("Video"),
text="",
font=("Arial", 20),
text_color="red",
)
self.video_error_path_header.place(relx=0.5, rely=0.6, anchor="center")
self.video_path = ctk.CTkLabel(master=self.tab_view.tab("Video"),
text="",
font=("Arial", 15))
self.video_path.place(relx=0.5, rely=0.65, anchor="center")
self.video_detect_button = ctk.CTkButton(
master=self.tab_view.tab("Video"),
text="Detect now",
font=("Arial", 30),
command=lambda: self.video_detection(),
width=150,
height=18,
corner_radius=10,
)
self.video_detect_button.place_forget()
def image_detection(self):
""" """
from detection import image_detection
image_detection(self)
def video_detection(self):
""" """
from detection import video_detection
video_detection(self)
def webcam_detection(self):
""" """
from detection import webcam_detection
webcam_detection(self)