-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.py
57 lines (48 loc) · 1.59 KB
/
display.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
from tkinter import *
import sqlite3
import pyttsx3
# connection to database
conn = sqlite3.connect('database.db')
c = conn.cursor()
# empty lists to append later
number = []
patients = []
sql = "SELECT * FROM appointments"
res = c.execute(sql)
for r in res:
ids = r[0]
name = r[1]
number.append(ids)
patients.append(name)
# window
class Application:
def __init__(self, master):
self.master = master
self.x = 0
# heading
self.heading = Label(master, text="Bookings", font=('arial 60 bold'), fg='green')
self.heading.place(x=350, y=0)
# button to change bookings
self.change = Button(master, text="Next Booking", width=25, height=2, bg='steelblue', command=self.func)
self.change.place(x=500, y=600)
# empty text labels to later config
self.n = Label(master, text="", font=('arial 200 bold'))
self.n.place(x=500, y=100)
self.pname = Label(master, text="", font=('arial 80 bold'))
self.pname.place(x=300, y=400)
# function to speak the text and update the text
def func(self):
self.n.config(text=str(number[self.x]))
self.pname.config(text=str(patients[self.x]))
engine = pyttsx3.init()
voices = engine.getProperty('voices')
rate = engine.getProperty('rate')
engine.setProperty('rate', rate-50)
engine.say('Booking number ' + str(number[self.x]) + str(patients[self.x]))
engine.runAndWait()
self.x += 1
root = Tk()
b = Application(root)
root.geometry("1366x768+0+0")
root.resizable(False, False)
root.mainloop()