tkinter toplevel

from tkinter import *

root = Tk()
l1 = Label(root, text="Main Window Label")
l1.pack()

top = Toplevel()
l2 = Label(top, text="Toplevel Window Label")
l2.pack()
top.mainloop()
root.mainloop()

Here is what the above code is Doing:
1. It creates a Tk object, which is the main window.
2. It creates a Label object, which is a widget that displays text.
3. It packs the Label object into the main window.
4. It creates a Toplevel object, which is a new window.
5. It creates a Label object, which is a widget that displays text.
6. It packs the Label object into the new window.
7. It starts the event loop for the new window.
8. It starts the event loop for the main window.

The event loop for the main window will continue to run until the user closes the main window.
The event loop for the new window will continue to run until the user closes the new window.

If you want to close the main window, you must close the new window first.

If you want to close the new window, you can use the destroy method.

The destroy method will destroy the widget and all its children.