so, recently I made a virtual assistant (Friday) successfully on windows. But the cli was boring so I tried to make it in gui but was having some error ->
Traceback (most recent call last):
File "e:\friday_\test.py", line 13, in <module>
speak("hi")
File "e:\friday_\test.py", line 9, in speak
text = tk.Label('Computer: ' + audio)
File "e:\python_important\lib\tkinter\__init__.py", line 3144, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "e:\python_important\lib\tkinter\__init__.py", line 2562, in __init__
BaseWidget._setup(self, master, cnf)
File "e:\python_important\lib\tkinter\__init__.py", line 2531, in _setup
self.tk = master.tk
AttributeError: 'str' object has no attribute 'tk'
Here is the actual code ->
import pyttsx3
import tkinter as tk
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
tk.Tk()
def speak(audio):
text = tk.Label('Computer: ' + audio)
engine.say(audio)
engine.runAndWait()
text.pack()
speak("hi")
tk.mainloop()
So, what can be the solution to this? any help would be appreciated
What I have tried:
I have tried searching on google but can't find it.