Q:

How do I use tkinter to create a menubar?

This is my first post, so please give feedback to improve if need be.
I am following the tkinter tutorial on tkdocs to learn tkinter. The current lesson is attempting to teach me how to create menus, but whenever I run their script, a separate window pops up instead of menu attached the the root window.
from tkinter import *
from tkinter import ttk

root = Tk()
root.option_add('*tearOff', FALSE)
win = Toplevel(root)
menubar = Menu(win)
win['menu'] = menubar

root.mainloop()

This pops up as a second window. I'm not sure if I am simply not understanding the material, or if I am doing something wrong. The lessons are written in the mindset that you are using at least python 3 and tkinter 8.6. I have the current Anaconda distribution and it meets both of these requirements. 
What am I doing incorrectly to have this code open a separate window as opposed to a menu attached to a window?

A:

I was able to figure out the issue. I misread the tutorial and expected a single window to open up with a menubar and a couple options within that menubar. After messing with the code, I was able to write a script that created the window I originally thought we were going to open. Ultimately, I didn't realize that "TopLevel" would open a separate window, so that was on me. Below is the code that I used to open up a window with the menubar.
from tkinter import *
from tkinter import ttk

root = Tk()
root.option_add('*tearOff', FALSE)

menubar = Menu(root)
menu_file = Menu(menubar)
menu_edit = Menu(menubar)
menubar.add_cascade(menu=menu_file, label='File')
menubar.add_cascade(menu=menu_edit, label='Edit')
root['menu'] = menubar

root.mainloop()

Thanks, and I hope this helps someone else understand what is happening if they are learning tkinter as well.

