diff --git a/main1.py b/main1.py new file mode 100644 index 0000000..64aa925 --- /dev/null +++ b/main1.py @@ -0,0 +1,28 @@ +import tkinter as tk +from tkinter.ttk import * +import subprocess +import sys + +def blink(): + subprocess.call([sys.executable, "face-try.py"]) + +def lane(): + subprocess.call([sys.executable, "blinkDetect.py"]) + +root = tk.Tk() +root.title("Driver Alert System") +root.geometry("500x500") + +frame = tk.Frame(root) +frame.pack(pady=50) + +button1 = tk.Button(frame, text="Face Detection", fg="red", command=blink, height=2, width=20) +button1.pack(side=tk.LEFT, padx=10) + +button2 = tk.Button(frame, text="Blink Detection", fg="red", command=lane, height=2, width=20) +button2.pack(side=tk.RIGHT, padx=10) + +button3 = tk.Button(root, text="Quit", fg="red", command=root.destroy, height=2, width=20) +button3.pack(side=tk.BOTTOM, pady=20) + +root.mainloop() diff --git a/ui1.py b/ui1.py new file mode 100644 index 0000000..b4a4141 --- /dev/null +++ b/ui1.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Dec 31 17:27:12 2019 +@author: Lenovo +""" + +import tkinter as tk +from tkinter.ttk import * +import subprocess +import sys +from threading import Thread + +def run_script(script_name): + def target(): + subprocess.call([sys.executable, script_name]) + Thread(target=target).start() + +def face(): + run_script("face-try.py") + +def blink(): + run_script("blinkDetect.py") + +def lane(): + run_script("lanedetection.py") + +# GUI setup +root = tk.Tk() +root.geometry('300x550') +root.title('Drowsiness Detection System') + +style = Style() +style.configure('TButton', font=('calibri', 16, 'bold'), borderwidth='2', padding=10) + +# Buttons +btn1 = Button(root, text='Face Detection', command=face) +btn1.pack(pady=40) + +btn2 = Button(root, text='Blink Detection', command=blink) +btn2.pack(pady=20) + +btn4 = Button(root, text='Lane Detection', command=lane) +btn4.pack(pady=30) + +btn3 = Button(root, text='Quit', command=root.destroy) +btn3.pack(pady=30) + +root.mainloop()