-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlarm+.py
70 lines (47 loc) · 1.39 KB
/
Alarm+.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
import tkinter as tk
from tkinter import messagebox, Button, Label
import cv2
window = None
instrument = None
timer = -1
FRAME_UPDATE_MS = 10
SCREEN_WIDTH, SCREEN_HEIGHT = 0, 0
def center_window(width, height):
global window
coords = center_coords(width, height)
window.geometry("%dx%d%+d%+d" % (width, height, coords[0], coords[1]))
def center_coords(width, height):
global SCREEN_HEIGHT, SCREEN_WIDTH
return ((SCREEN_WIDTH - width) // 2, (SCREEN_HEIGHT - height) // 2)
def close_popup():
global window
window.destroy()
window.update()
def popup_message(message):
global window
window = tk.Toplevel()
window.title("TITLE HERE")
label = tk.Label(window, text=message)
label.pack()
b = Button(window, text="Close", command=close_popup)
b.pack()
def create_alarm():
pass
def init_tk():
submit = Button(root, text="Create Alarm", command=create_alarm)
submit.pack()
pass
width, height = 800, 600
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
root = tk.Tk()
root.title("AirGuitar")
coords = center_coords(width, height)
root.geometry("%dx%d%+d%+d" % (width, height, coords[0], coords[1]))
root.bind('<Escape>', lambda e: root.quit())
lmain = tk.Label(root)
lmain.pack()
SCREEN_WIDTH = root.winfo_screenwidth()
SCREEN_HEIGHT = root.winfo_screenheight()
root.mainloop()