M
Max Williams
I have a text field, and i want to get the value out of it when the user
presses Return or tabs to another field. Currently i'm doing it like
this:
name_field = TkEntry.new(root)
var = TkVariable.new("f")
name_field.textvariable(name_var)
name_field.pack()
name_field.bind("Key-Return") { name_field_value = name_var.value }
name_field.bind("FocusOut") { name_field_value = name_var.value }
It seems like there should be a way to combine these, like
name_field.bind("Key-Return" || "FocusOut") #doesn't work
name_field.bind("Key-Return", "FocusOut") #doesn't work either
But these doesn't work. Can anyone tell me how to do this please?
presses Return or tabs to another field. Currently i'm doing it like
this:
name_field = TkEntry.new(root)
var = TkVariable.new("f")
name_field.textvariable(name_var)
name_field.pack()
name_field.bind("Key-Return") { name_field_value = name_var.value }
name_field.bind("FocusOut") { name_field_value = name_var.value }
It seems like there should be a way to combine these, like
name_field.bind("Key-Return" || "FocusOut") #doesn't work
name_field.bind("Key-Return", "FocusOut") #doesn't work either
But these doesn't work. Can anyone tell me how to do this please?