Write Python GUI program to add menu bar with name of colors as options to change the background color as per selection from menu option.
import
tkinter as tk
color = var.get()
root['bg'] = color
root
= tk.Tk()
#
initial value
var.set('red')
choices
= ['red', 'green', 'blue', 'yellow','white', 'magenta']
option
= tk.OptionMenu(root, var, *choices)
option.pack(side='left',
padx=10, pady=10)
button
= tk.Button(root, text="check value slected", command=select)
button.pack(side='left',
padx=20, pady=10)