summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/event.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tk/event.rb')
-rw-r--r--ext/tk/lib/tk/event.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index d07b3b5a85..bf4e122322 100644
--- a/ext/tk/lib/tk/event.rb
+++ b/ext/tk/lib/tk/event.rb
@@ -8,7 +8,7 @@ end
########################
require 'tkutil'
-require 'tk'
+require 'tk' unless Object.const_defined? :TkComm
########################
@@ -482,6 +482,26 @@ module TkEvent
end
})
end
+ elsif cmd.respond_to?(:arity) && cmd.arity == 0 # args.size == 0
+ args = ''
+ if cmd.kind_of?(String)
+ id = cmd
+ elsif cmd.kind_of?(TkCallbackEntry)
+ id = install_cmd(cmd)
+ else
+ id = install_cmd(proc{
+ begin
+ TkUtil.eval_cmd(cmd)
+ rescue Exception=>e
+ if TkCore::INTERP.kind_of?(TclTkIp)
+ fail e
+ else
+ # MultiTkIp
+ fail Exception, "#{e.class}: #{e.message.dup}"
+ end
+ end
+ })
+ end
else
keys, args = klass._get_all_subst_keys