Tkinter Entry widget in Python is uneditable
You just write box.focus_force()
below box.pack()
and that should do the work for you.
This should fix it
import tkinter as tkfrom tkinter.filedialog import askopenfilenamelocation = ''root = tk.Tk()root.withdraw()location = askopenfilename(defaultextension='.db', title="Choose your database", filetypes=[('Database Files', '.db'), ('All files', '*')])start = tk.Tk()tk.Label(start, text='What is the name of your table?').pack()box = tk.Entry(start, exportselection=0, state=tk.DISABLED)box.pack()start.focus_set()box.focus_set()start.focus_force()button = tk.Button(start, text='OK', command=lambda e: None)button.pack()box.config(state=tk.NORMAL)start.mainloop()
By running the askopenfilename
first you can avoid this issue.
In doing it this way you need to make a root
window and withdraw it or you will get two windows.
By using focus_set
and focus_force
you can make the box immediately ready to use.