Why python isn't using other Tkinter?
- You are using both duplicates one for
msg = tk.Button
and msg = tk.Label
. That will cause conflict.
- Add
extra_window
for Toplever
widgets.
- remove extra_window.mainloop(). One mainloop() will do entire script.
Snippet modified:
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
def create_window():
extra_window = tk.Toplevel()
msg_label = tk.Label(extra_window, text='What you wanna eat',
bg='black', fg='white', width=20, height=2)
entry = tk.Entry(extra_window, bg='white', fg='black')
msg_label.pack()
entry.pack(expand=True)
window = tk.Tk()
window.geometry('300x400')
window.title('Game')
msg = tk.Button(window, text='Start', bg='purple', fg='white', command=create_window)
msg.pack()
window.mainloop()
Screenshot:

