How do I make user input added to list in dropdown in Python?

Viewed 31

I want the user to add colors if it's not in the list.

cars = ['Blue', 'Red', 'Green'] 
if entry not in cars: 
    cars.append(cars) 

options = ['Blue', 
'Red',
'Green'] 

clicked = StringVar()
clicked.set( "List" )
drop = OptionMenu( root , clicked , *options )
drop.pack()
button = Button( root , text = "click Me" , command = show ).pack()

If the user enters something such as 'Yellow', Im trying to get it to add it into the drop down menu list.

0 Answers
Related