Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions main1.py
Original file line number Diff line number Diff line change
@@ -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()
48 changes: 48 additions & 0 deletions ui1.py
Original file line number Diff line number Diff line change
@@ -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()