I have written the below code to create a tkinter form with a menu bar, I am using the canvas widget to arrange all the buttons and labels, however I am not able to show the menubar on the canvas below is the code I have written to do this:
from tkinter import *
import tkinter as tk
window = Tk()
window.title("test")
window.geometry("500*500")
canvas1 = Canvas(window, width= 500, height= 500, bg = 'midnight blue')
menubar = tk.Menu(window)
filemenu = tk.Menu(menubar, tearoff=0)
filemenu.add_command(label="New",command=dosomething)
filemenu.add_command(label="Edit",command=dosomething)
button1 = tk.Button(window, text="Say Hello")
window.config(menu = menubar)
canvas1.create_window(100,100, window = button1)
window.mainloop()
I am not sure how to display the menubar on the top of the canvas, please help on how to do this.