I want my program to execute a command whenever a new selection is made
from a TkOptionMenubutton. The -command option isn’t allowed with
TkOptionMenubuttons, so I’ve been experimenting with various bindings,
but can’t find an appropriate binding event.
I’ve tried the following simple example which should print the value of
the selection, but it only works if the mouse is directly over the
button itself, and not over the expanded options.
list = [“1”, “2”, “3”, “4”, “5”]
var = TkVariable.new
button = TkOptionMenubutton.new(root,var,*list).pack
button.bind(‘ButtonRelease-1’) do
print var, “\n”
end
From: Alex DeCaria [email protected]
Subject: Binding or executing a command with a TkOptionMenubutton
Date: Fri, 16 Mar 2007 22:13:22 +0900
Message-ID: [email protected]
I’ve tried the following simple example which should print the value of
the selection, but it only works if the mouse is directly over the
button itself, and not over the expanded options.