-
Notifications
You must be signed in to change notification settings - Fork 4
/
gui.py
30 lines (21 loc) · 813 Bytes
/
gui.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
import tkinter as tk
root = tk.Tk()
main_frame = tk.Frame(master=root)
chat_listbox = tk.Listbox(master=main_frame, height=200, width=50)
scroll_bar = tk.Scrollbar(master=main_frame)
speak_button = tk.Button(master=root, text='Speak', command=lambda: None)
def set_speak_command(command):
speak_button.configure(command=command)
speak_button.pack(side=tk.LEFT, anchor=tk.SW)
def speak(text):
chat_listbox.insert('end', f'Assistant: {text}')
scroll_bar.pack(side=tk.RIGHT, fill=tk.Y)
chat_listbox.pack(fill=tk.Y, side=tk.RIGHT)
scroll_bar.configure(command=chat_listbox.yview)
chat_listbox.configure(yscrollcommand=scroll_bar.set)
main_frame.pack(fill=tk.BOTH)
root.geometry('700x500')
root.minsize(700, 500)
root.wm_title('Desktop assistant')
root.resizable(False, True)
mainloop = root.mainloop