StringVar is not working inside the Optionmenu

82 Views Asked by At

I cannot get the StringVar class to work in my OptionMenu widget, it just appears blank in the OptionMenu. This works on my main window but not this pop-up window here is my code.

def create_new():
    new = tk.Tk()
    new.geometry('300x400')
    new.title('Create New Project')

    l1 = Label(new, text = 'Name of the Project: ', font = ('Arial', 13))
    name = Entry(new)

    menu = StringVar()
    menu.set('Type of Project')
    drop = OptionMenu(new, menu, 'Type of Project', 'Photo Editing', 'lol')

    l1.pack()
    name.pack()
    drop.pack()

Note: I am creating another tkinter window for this.

The optionmenu appears like this The option menu is just empty

0

There are 0 best solutions below