How can I config the menu in tkinter python

Viewed 41

How can I configure the menu in tkinter python

I have tried cofiguring in the menubar

Please look at the code

import tkinter as tk

class GUI(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)
        self.title("Yash gui")
        self.geometry("700x500")
        self.maxsize(700, 500)
        self.minsize(700, 500)


    def textbox(self, just):
        textb = tk.Text()
        textb.pack(fill=just, expand=True)

    def menubar(self):
      main_m = tk.Menu()
      file_m = tk.Menu(main_m)
      main_m.add_cascade(label='File', menu=main_m)
      file_m.add_command(label="New file")
      file_m.add_command(label="Open")
      file_m.add_command(label="Save as")
      self.configure(menu=main_m)

if __name__ == "__main__":
    root = GUI()
    root.textbox(tk.BOTH)
    root.mainloop()

The output window is also not showing

0 Answers
Related