I want to make a menubutton which display the name of the menu items selected I ve written :
but only the last name of the list is display whatever the item I select
Code:
set mylist [list BAGA DOLE FIAGAR GRASS GRENO LESIM LIMOG MONTP PALMA VENTO]
set myMenuButton [menubutton .myMenuButton -menu .myMenuButton.myMenu -textvariable buttonName]
set buttonName [lindex $radars 0]
set names [menu .myMenuButton.myMenu]
foreach name $mylist {
$names add command -label $name -command {set buttonName $name
}
}