1# 2# tk/console.rb : control the console on system without a real console 3# 4require 'tk' 5 6module TkConsole 7 include Tk 8 extend Tk 9 10 TkCommandNames = ['console'.freeze, 'consoleinterp'.freeze].freeze 11 12 def self.create 13 TkCore::INTERP._create_console 14 end 15 self.create # initialize console 16 17 def self.title(str=None) 18 tk_call 'console', str 19 end 20 def self.hide 21 tk_call_without_enc('console', 'hide') 22 end 23 def self.show 24 tk_call_without_enc('console', 'show') 25 end 26 def self.eval(tcl_script) 27 # 28 # supports a Tcl script only 29 # I have no idea to support a Ruby script seamlessly. 30 # 31 _fromUTF8(tk_call_without_enc('console', 'eval', 32 _get_eval_enc_str(tcl_script))) 33 end 34 def self.maininterp_eval(tcl_script) 35 # 36 # supports a Tcl script only 37 # I have no idea to support a Ruby script seamlessly. 38 # 39 _fromUTF8(tk_call_without_enc('consoleinterp', 'eval', 40 _get_eval_enc_str(tcl_script))) 41 42 end 43 def self.maininterp_record(tcl_script) 44 # 45 # supports a Tcl script only 46 # I have no idea to support a Ruby script seamlessly. 47 # 48 _fromUTF8(tk_call_without_enc('consoleinterp', 'record', 49 _get_eval_enc_str(tcl_script))) 50 51 end 52end 53