-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabs.py
116 lines (104 loc) · 4.07 KB
/
tabs.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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import customtkinter as ctk
from utils import open_file_dialog
class Tabs(ctk.CTkTabview):
""" """
def __init__(self, master, app, **kwargs):
super().__init__(master, **kwargs)
self.app = app
# Create tabs
self.add("Home")
self.add("Image")
self.add("Video")
self.add("Webcam")
# Home tab content
home_title = ctk.CTkLabel(master=self.tab("Home"),
text="Welcome to",
font=("Arial", 40))
home_title.place(relx=0.5, rely=0.1, anchor="center")
home_subtitle = ctk.CTkLabel(
master=self.tab("Home"),
text="DetectoBuddy",
font=("Arial", 60),
text_color="#007bff",
)
home_subtitle.place(relx=0.5, rely=0.2, anchor="center")
home_description = ctk.CTkLabel(
master=self.tab("Home"),
text=
"This is a simple object detection application that can detect\nobjects in images, videos, and webcam\n\n\n\nUse the tabs to navigate the application.",
font=("Arial", 20),
)
home_description.place(relx=0.5, rely=0.5, anchor="center")
home_footer = ctk.CTkLabel(
master=self.tab("Home"),
text=
"Developed by: Luca Facchini (LF-D3v) & Avaab Razzaq (AR10Dev)",
font=("Arial", 13),
)
home_footer.place(relx=0.5, rely=0.9, anchor="center")
# Image tab content
image_title = ctk.CTkLabel(master=self.tab("Image"),
text="Detection from",
font=("Arial", 30))
image_title.place(relx=0.5, rely=0.1, anchor="center")
image_subtitle = ctk.CTkLabel(
master=self.tab("Image"),
text="Image",
font=("Arial", 40),
text_color="#007bff",
)
image_subtitle.place(relx=0.5, rely=0.2, anchor="center")
image_select_file_button = ctk.CTkButton(
master=self.tab("Image"),
text="Select Image",
font=("Arial", 30),
command=lambda: open_file_dialog("Image", self.app),
width=150,
height=18,
corner_radius=10,
)
image_select_file_button.place(relx=0.5, rely=0.4, anchor="center")
# Video tab content
video_title = ctk.CTkLabel(master=self.tab("Video"),
text="Detection from",
font=("Arial", 30))
video_title.place(relx=0.5, rely=0.1, anchor="center")
video_subtitle = ctk.CTkLabel(
master=self.tab("Video"),
text="Video",
font=("Arial", 40),
text_color="#007bff",
)
video_subtitle.place(relx=0.5, rely=0.2, anchor="center")
video_select_file_button = ctk.CTkButton(
master=self.tab("Video"),
text="Select Video",
font=("Arial", 30),
command=lambda: open_file_dialog("Video", self.app),
width=150,
height=18,
corner_radius=10,
)
video_select_file_button.place(relx=0.5, rely=0.4, anchor="center")
# Webcam tab content
webcam_title = ctk.CTkLabel(master=self.tab("Webcam"),
text="Detection from",
font=("Arial", 30))
webcam_title.place(relx=0.5, rely=0.1, anchor="center")
webcam_subtitle = ctk.CTkLabel(
master=self.tab("Webcam"),
text="Webcam",
font=("Arial", 40),
text_color="#007bff",
)
webcam_subtitle.place(relx=0.5, rely=0.2, anchor="center")
webcam_start_button = ctk.CTkButton(
master=self.tab("Webcam"),
text="Start Webcam",
font=("Arial", 30),
command=lambda: self.app.webcam_detection(),
width=150,
height=18,
corner_radius=10,
)
webcam_start_button.place(relx=0.5, rely=0.4, anchor="center")