I am new to GUI programming so I don’t know why this is not working when I run this program it doesn’t open tkinter window so help me out,this is only running speech recognition program
JavaScript
x
18
18
1
from tkinter import *
2
import speech_recognition as sr
3
a=1
4
r = sr.Recognizer()
5
with sr.Microphone() as source:
6
print("Speak Anything: ")
7
audio=r.listen(source)
8
try:
9
text=r.recognize_google(audio)
10
print("You Said : {}".format(text))
11
except:
12
print("Sorry could not recognize your voice")
13
14
root=Tk()
15
root.geometry("2000x700")
16
root.title("GUI")
17
root.configure(bg="#696969")
18
Advertisement
Answer
Simply add root.mainloop()
at the very end of the script. This is one of the must-haves when you make a script using Tkinter.