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
from tkinter import *
import speech_recognition as sr
a=1
r = sr.Recognizer()
with sr.Microphone() as source:
print("Speak Anything: ")
audio=r.listen(source)
try:
text=r.recognize_google(audio)
print("You Said : {}".format(text))
except:
print("Sorry could not recognize your voice")
root=Tk()
root.geometry("2000x700")
root.title("GUI")
root.configure(bg="#696969")
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.