2021-10-08 12:23:09 +05:30
|
|
|
import tkinter as tk
|
2021-10-08 22:34:34 +05:30
|
|
|
|
2021-10-08 12:23:09 +05:30
|
|
|
root = tk.Tk()
|
2021-10-08 23:00:26 +05:30
|
|
|
main_frame = tk.Frame(master=root)
|
|
|
|
|
chat_listbox = tk.Listbox(master=main_frame, height=200, width=50)
|
|
|
|
|
scroll_bar = tk.Scrollbar(master=main_frame)
|
2021-10-08 12:23:09 +05:30
|
|
|
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):
|
2021-10-08 23:00:26 +05:30
|
|
|
chat_listbox.insert('end', f'Assistant: {text}')
|
|
|
|
|
root.geometry('700x500')
|
2021-10-08 12:23:09 +05:30
|
|
|
|
|
|
|
|
|
2021-10-08 23:00:26 +05:30
|
|
|
chat_listbox.pack(fill=tk.Y, side=tk.LEFT)
|
|
|
|
|
scroll_bar.pack(side=tk.RIGHT, fill=tk.Y)
|
|
|
|
|
scroll_bar.configure(command=chat_listbox.yview)
|
|
|
|
|
chat_listbox.configure(yscrollcommand=scroll_bar.set)
|
|
|
|
|
main_frame.pack(fill=tk.BOTH)
|
2021-10-08 12:23:09 +05:30
|
|
|
root.wm_title('Desktop assistant')
|
|
|
|
|
root.resizable(False, False)
|
|
|
|
|
mainloop = root.mainloop
|