Module: TkCore
  
  
  
  
  
  
  
      - Extended by:
- TkComm
      - Includes:
- TkComm
    - Included in:
- Tk, Tk::BLT, Tk::BLT::Bitmap, Tk::BLT::Busy, Tk::BLT::DnD, Tk::BLT::DragDrop, Tk::BLT::Printer, Tk::BLT::Spline, Tk::BLT::Ted, Tk::BLT::Watch, Tk::BLT::Winop, Tk::BWidget, Tk::Busy, Tk::Busy, Tk::Clock, Tk::Iwidgets, Tk::Iwidgets::Labeledwidget, Tk::Mac, Tk::Tcllib::Autoscroll, Tk::Tcllib::Crosshair, Tk::Tcllib::Cursor, Tk::Tcllib::Diagrams, Tk::Tcllib::History, Tk::Tcllib::Plotchart, Tk::Tcllib::Plotchart::ChartMethod, Tk::Tcllib::Style, Tk::Tcllib::Tooltip, Tk::Tcllib::Validator, Tk::Tile::Style, Tk::TkDND::Shape, Tk::Trofs, Tk::Wm, TkFont, TkFont::Chooser, TkFont::CoreMethods, TkMsgCatalog, TkObject, TkPackage, TkTimer, TkTimer, TkVariable
    - Defined in:
- lib/multi-tk.rb,
 lib/multi-tk.rb,
 lib/tk.rb
 
Overview
  
    
start Tk which depends on MultiTkIp
   
 
  
Defined Under Namespace
  
    
  
    
      Classes: Tk_OBJECT_TABLE
    
  
  
    
      Constant Summary
      collapse
    
    
      
        - INTERP_THREAD =
          
        
- Thread.new{
  begin
        interp = TclTkIp.new(name, opts)
  rescue => e
    Thread.current[:interp] = e
    raise e
  end
  interp.mainloop_abort_on_exception = true
  Thread.current.instance_variable_set("@interp", interp)
  status = [nil]
  def status.value
    self[0]
  end
  def status.value=(val)
    self[0] = val
  end
  Thread.current[:status] = status
  
    interp._eval <<EOS
wm withdraw .
rename wm __wm_orig__
proc wm {subcmd win args} {
  set val [eval [list __wm_orig__ $subcmd $win] $args]
  if {[string equal $subcmd withdraw] && [string equal $win .]} {
    rename wm {}
    rename __wm_orig__ wm
  }
  return $val
}
proc __startup_rbtk_mainloop__ {args} {
  rename __startup_rbtk_mainloop__ {}
  if {[info command __wm_orig__] == "__wm_orig__"} {
    rename wm {}
    rename __wm_orig__ wm
    if [string equal [wm state .] withdrawn] {
wm deiconify .
    }
  }
}
set __initial_state_of_rubytk__ 1
trace add variable __initial_state_of_rubytk__ unset __startup_rbtk_mainloop__
# complete initializing
ruby {TkCore::INTERP_THREAD[:interp] = TkCore::INTERP_THREAD.instance_variable_get('@interp')}
EOS
  begin
    begin
                              Thread.current[:status].value = interp.mainloop(true)
    rescue SystemExit=>e
      Thread.current[:status].value = e
    rescue Exception=>e
      Thread.current[:status].value = e
      p e if $DEBUG
      retry if interp.has_mainwindow?
    ensure
      INTERP_MUTEX.synchronize{ INTERP_ROOT_CHECK.broadcast }
    end
    unless interp.deleted?
      begin
                Thread.current[:status].value = interp.mainloop(false)
      rescue Exception=>e
        puts "ignore exception on interp: #{e.inspect}\n" if $DEBUG
      end
    end
  ensure
                interp.delete
  end
}
- INTERP_THREAD_STATUS =
          
        
- INTERP_MUTEX =
          
        
- Mutex.new 
- INTERP_ROOT_CHECK =
          
        
- ConditionVariable.new 
- INTERP =
          
        
- WITH_RUBY_VM =
          
        
- Object.const_defined?(:RubyVM) && ::RubyVM.class == Class 
- WITH_ENCODING =
          
        
- defined?(::Encoding.default_external) && true 
- RUN_EVENTLOOP_ON_MAIN_THREAD =
          
  
    
Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!! 
 
 
  
 
- false 
- WIDGET_DESTROY_HOOK =
          
        
- '<WIDGET_DESTROY_HOOK>' 
- EventFlag =
          
        
- TclTkLib::EventFlag 
Constants included
     from TkComm
  TkComm::GET_CONFIGINFO_AS_ARRAY, TkComm::GET_CONFIGINFOwoRES_AS_ARRAY, TkComm::TkExtlibAutoloadModule, TkComm::Tk_CMDTBL, TkComm::Tk_IDs, TkComm::Tk_WINDOWS, TkComm::USE_TCLs_LIST_FUNCTIONS, TkComm::WidgetClassNames
  
  
  Constants included
     from TkUtil
  TkUtil::None, TkUtil::RELEASE_DATE
  
    
      Class Method Summary
      collapse
    
    
  
    
      Instance Method Summary
      collapse
    
    
      
        - 
  
    
      #_tk_call_to_list_core(depth, arg_enc, val_enc, *args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #after(ms, cmd = Proc.new)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #after_cancel(afterId)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
def after_idle(cmd=Proc.new)     crit_bup = Thread.critical     Thread.critical = true. 
 
- 
  
    
      #after_idle(cmd = Proc.new)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
def after(ms, cmd=Proc.new)     crit_bup = Thread.critical     Thread.critical = true. 
 
- 
  
    
      #appname(name = None)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #appsend(interp, async, *args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #appsend_deny  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #appsend_displayof(interp, win, async, *args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #callback_break  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #callback_continue  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #callback_return  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #chooseColor(keys = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #chooseDirectory(keys = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #do_one_event(flag = TclTkLib::EventFlag::ALL)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #event_generate(win, context, keys = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #get_eventloop_tick  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #get_eventloop_weight  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #get_no_event_wait  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #getMultipleOpenFile(keys = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #getMultipleSaveFile(keys = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #getOpenFile(keys = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #getSaveFile(keys = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #inactive  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #inactive_displayof(win)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #info(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #ip_eval(cmd_string)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #ip_eval_with_enc(cmd_string)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #ip_eval_without_enc(cmd_string)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #ip_invoke(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #ip_invoke_with_enc(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #ip_invoke_without_enc(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #is_mainloop?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #load_cmd_on_ip(tk_cmd)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #mainloop(check_root = true)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #mainloop_exist?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #mainloop_thread?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #mainloop_watchdog(check_root = true)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #messageBox(keys)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #rb_appsend(interp, async, *args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #rb_appsend_displayof(interp, win, async, *args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #reset_inactive  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #reset_inactive_displayof(win)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #restart(app_name = nil, keys = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #scaling(scale = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #scaling_displayof(win, scale = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #set_eventloop_tick(timer_tick)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #set_eventloop_weight(loop_max, no_event_tick)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #set_no_event_wait(wait)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #tk_call(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #tk_call_to_list(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
private :_tk_call_to_list_core. 
 
- 
  
    
      #tk_call_to_list_with_enc(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #tk_call_to_list_without_enc(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #tk_call_to_simplelist(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #tk_call_to_simplelist_with_enc(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #tk_call_to_simplelist_without_enc(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #tk_call_with_enc(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #tk_call_without_enc(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
- 
  
    
      #windowingsystem  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
  
Methods included from TkComm
  _at, _callback_entry?, _callback_entry_class?, _curr_cmd_id, _fromUTF8, _genobj_for_tkwidget, _next_cmd_id, _toUTF8, array2tk_list, bind, bind_all, bind_append, bind_append_all, bind_remove, bind_remove_all, bindinfo, bindinfo_all, bool, image_obj, install_cmd, install_cmd, list, num_or_nil, num_or_str, number, procedure, simplelist, slice_ary, string, subst, tk_tcl2ruby, uninstall_cmd, uninstall_cmd, window
  
  
  
  
  
  
  
  
  Methods included from TkUtil
  _conv_args, #_conv_args, #_fromUTF8, #_get_eval_enc_str, _get_eval_enc_str, #_get_eval_string, _get_eval_string, _symbolkey2str, #_symbolkey2str, #_toUTF8, bool, #bool, eval_cmd, #hash_kv, hash_kv, install_cmd, num_or_nil, #num_or_nil, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd, untrust
  
  
  
  
  
  
  
  
  Methods included from TkEvent
  #install_bind, #install_bind_for_event_class
  
    Class Method Details
    
      
  
  
    .callback(*arg)  ⇒ Object 
  
  
  
  
    | 
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643 | # File 'lib/tk.rb', line 1601
def TkCore.callback(*arg)
  begin
    if TkCore::INTERP.tk_cmd_tbl.kind_of?(Hash)
            normal_ret = false
      ret = catch(:IRB_EXIT) do          retval = TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg)
        normal_ret = true
        retval
      end
      unless normal_ret
                exit(ret)
      end
      ret
    end
  rescue SystemExit=>e
    exit(e.status)
  rescue Interrupt=>e
    fail(e)
  rescue Exception => e
    begin
      msg = _toUTF8(e.class.inspect) + ': ' +
            _toUTF8(e.message) + "\n" +
            "\n---< backtrace of Ruby side >-----\n" +
            _toUTF8(e.backtrace.join("\n")) +
            "\n---< backtrace of Tk side >-------"
      if TkCore::WITH_ENCODING
        msg.force_encoding('utf-8')
      else
        msg.instance_variable_set(:@encoding, 'utf-8')
      end
    rescue Exception
      msg = e.class.inspect + ': ' + e.message + "\n" +
            "\n---< backtrace of Ruby side >-----\n" +
            e.backtrace.join("\n") +
            "\n---< backtrace of Tk side >-------"
    end
            fail(e, msg)
  end
end | 
 
    
   
  
    Instance Method Details
    
      
  
  
    #_tk_call_to_list_core(depth, arg_enc, val_enc, *args)  ⇒ Object 
  
  
  
  
    | 
2125
2126
2127
2128
2129
2130
2131
2132
2133 | # File 'lib/tk.rb', line 2125
def _tk_call_to_list_core(depth, arg_enc, val_enc, *args)
  args = _conv_args([], arg_enc, *args)
  val = _tk_call_core(false, *args)
  if !depth.kind_of?(Integer) || depth == 0
    tk_split_simplelist(val, false, val_enc)
  else
    tk_split_list(val, depth, false, val_enc)
  end
end | 
 
    
      
  
  
    #after(ms, cmd = Proc.new)  ⇒ Object 
  
  
  
  
    | 
1687
1688
1689
1690
1691
1692 | # File 'lib/tk.rb', line 1687
def after(ms, cmd=Proc.new)
  cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(cmdid); ret})
  after_id = tk_call_without_enc("after",ms,cmdid)
  after_id.instance_variable_set('@cmdid', cmdid)
  after_id
end | 
 
    
      
  
  
    #after_cancel(afterId)  ⇒ Object 
  
  
  
  
    
def after_idle(cmd=Proc.new)
  crit_bup = Thread.critical
  Thread.critical = true
  myid = _curr_cmd_id
  cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(myid); ret})
  Thread.critical = crit_bup
  tk_call_without_enc('after','idle',cmdid)
end
   
 
  
  
    | 
1739
1740
1741
1742
1743
1744
1745
1746 | # File 'lib/tk.rb', line 1739
def after_cancel(afterId)
  tk_call_without_enc('after','cancel',afterId)
  if (cmdid = afterId.instance_variable_get('@cmdid'))
    afterId.instance_variable_set('@cmdid', nil)
    uninstall_cmd(cmdid)
  end
  afterId
end | 
 
    
      
  
  
    #after_idle(cmd = Proc.new)  ⇒ Object 
  
  
  
  
    
def after(ms, cmd=Proc.new)
crit_bup = Thread.critical
Thread.critical = true
myid = _curr_cmd_id
cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(myid); ret})
Thread.critical = crit_bup
tk_call_without_enc("after",ms,cmdid)  
#    return #    if false #defined? Thread #      Thread.start do #       ms = Float(ms)/1000 #       ms = 10 if ms == 0 #       sleep ms/1000 #       cmd.call #      end #    else #      cmdid = install_cmd(cmd) #      tk_call(“after”,ms,cmdid) #    end
end
   
 
  
  
    | 
1719
1720
1721
1722
1723
1724 | # File 'lib/tk.rb', line 1719
def after_idle(cmd=Proc.new)
  cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(cmdid); ret})
  after_id = tk_call_without_enc('after','idle',cmdid)
  after_id.instance_variable_set('@cmdid', cmdid)
  after_id
end | 
 
    
      
  
  
    #appname(name = None)  ⇒ Object 
  
  
  
  
    | 
1780
1781
1782 | # File 'lib/tk.rb', line 1780
def appname(name=None)
  tk_call('tk', 'appname', name)
end | 
 
    
      
  
  
    #appsend(interp, async, *args)  ⇒ Object 
  
  
  
  
    | 
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801 | # File 'lib/tk.rb', line 1788
def appsend(interp, async, *args)
  if $SAFE >= 1 && args.find{|obj| obj.tainted?}
    fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}"
  end
  if async != true && async != false && async != nil
    args.unshift(async)
    async = false
  end
  if async
    tk_call('send', '-async', '--', interp, *args)
  else
    tk_call('send', '--', interp, *args)
  end
end | 
 
    
      
  
  
    #appsend_deny  ⇒ Object 
  
  
  
  
    | 
1784
1785
1786 | # File 'lib/tk.rb', line 1784
def appsend_deny
  tk_call('rename', 'send', '')
end | 
 
    
      
  
  
    #appsend_displayof(interp, win, async, *args)  ⇒ Object 
  
  
  
  
    | 
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833 | # File 'lib/tk.rb', line 1819
def appsend_displayof(interp, win, async, *args)
  if $SAFE >= 1 && args.find{|obj| obj.tainted?}
    fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}"
  end
  win = '.' if win == nil
  if async != true && async != false && async != nil
    args.unshift(async)
    async = false
  end
  if async
    tk_call('send', '-async', '-displayof', win, '--', interp, *args)
  else
    tk_call('send', '-displayor', win, '--', interp, *args)
  end
end | 
 
    
      
  
  
    #callback_break  ⇒ Object 
  
  
  
  
    | 
1589
1590
1591 | # File 'lib/tk.rb', line 1589
def callback_break
  fail TkCallbackBreak, "Tk callback returns 'break' status"
end | 
 
    
      
  
  
    #callback_continue  ⇒ Object 
  
  
  
  
    | 
1593
1594
1595 | # File 'lib/tk.rb', line 1593
def callback_continue
  fail TkCallbackContinue, "Tk callback returns 'continue' status"
end | 
 
    
      
  
  
    #callback_return  ⇒ Object 
  
  
  
  
    | 
1597
1598
1599 | # File 'lib/tk.rb', line 1597
def callback_return
  fail TkCallbackReturn, "Tk callback returns 'return' status"
end | 
 
    
      
  
  
    #chooseColor(keys = nil)  ⇒ Object 
  
  
  
  
    | 
2015
2016
2017 | # File 'lib/tk.rb', line 2015
def chooseColor(keys = nil)
  tk_call('tk_chooseColor', *hash_kv(keys))
end | 
 
    
      
  
  
    #chooseDirectory(keys = nil)  ⇒ Object 
  
  
  
  
    | 
2019
2020
2021 | # File 'lib/tk.rb', line 2019
def chooseDirectory(keys = nil)
  tk_call('tk_chooseDirectory', *hash_kv(keys))
end | 
 
    
      
  
  
    #do_one_event(flag = TclTkLib::EventFlag::ALL)  ⇒ Object 
  
  
  
 
    
      
  
  
    #event_generate(win, context, keys = nil)  ⇒ Object 
  
  
  
  
    | 
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995 | # File 'lib/tk.rb', line 1982
def event_generate(win, context, keys=nil)
    if context.kind_of?(TkEvent::Event)
    context.generate(win, ((keys)? keys: {}))
  elsif keys
    tk_call_without_enc('event', 'generate', win,
                        "<#{tk_event_sequence(context)}>",
                        *hash_kv(keys, true))
  else
    tk_call_without_enc('event', 'generate', win,
                        "<#{tk_event_sequence(context)}>")
  end
  nil
end | 
 
    
      
    
      
  
  
    #get_eventloop_weight  ⇒ Object 
  
  
  
 
    
      
  
  
    #get_no_event_wait  ⇒ Object 
  
  
  
  
    | 
1957
1958
1959 | # File 'lib/tk.rb', line 1957
def get_no_event_wait()
  TclTkLib.get_no_eventloop_wait
end | 
 
    
      
  
  
    #getMultipleOpenFile(keys = nil)  ⇒ Object 
  
  
  
  
    | 
2004
2005
2006 | # File 'lib/tk.rb', line 2004
def getMultipleOpenFile(keys = nil)
  simplelist(tk_call('tk_getOpenFile', '-multiple', '1', *hash_kv(keys)))
end | 
 
    
      
  
  
    #getMultipleSaveFile(keys = nil)  ⇒ Object 
  
  
  
  
    | 
2011
2012
2013 | # File 'lib/tk.rb', line 2011
def getMultipleSaveFile(keys = nil)
  simplelist(tk_call('tk_getSaveFile', '-multiple', '1', *hash_kv(keys)))
end | 
 
    
      
  
  
    #getOpenFile(keys = nil)  ⇒ Object 
  
  
  
  
    | 
2001
2002
2003 | # File 'lib/tk.rb', line 2001
def getOpenFile(keys = nil)
  tk_call('tk_getOpenFile', *hash_kv(keys))
end | 
 
    
      
  
  
    #getSaveFile(keys = nil)  ⇒ Object 
  
  
  
  
    | 
2008
2009
2010 | # File 'lib/tk.rb', line 2008
def getSaveFile(keys = nil)
  tk_call('tk_getSaveFile', *hash_kv(keys))
end | 
 
    
      
  
  
    | 
1767
1768
1769 | # File 'lib/tk.rb', line 1767
def inactive
  Integer(tk_call_without_enc('tk', 'inactive'))
end | 
 
    
      
  
  
    #inactive_displayof(win)  ⇒ Object 
  
  
  
  
    | 
1770
1771
1772 | # File 'lib/tk.rb', line 1770
def inactive_displayof(win)
  Integer(tk_call_without_enc('tk', 'inactive', '-displayof', win))
end | 
 
    
      
  
  
    #info(*args)  ⇒ Object 
  
  
  
  
    | 
1852
1853
1854 | # File 'lib/tk.rb', line 1852
def info(*args)
  tk_call('info', *args)
end | 
 
    
      
  
  
    #ip_eval(cmd_string)  ⇒ Object 
  
  
  
  
    | 
2039
2040
2041 | # File 'lib/tk.rb', line 2039
def ip_eval(cmd_string)
  _ip_eval_core(nil, cmd_string)
end | 
 
    
      
  
  
    #ip_eval_with_enc(cmd_string)  ⇒ Object 
  
  
  
  
    | 
2047
2048
2049 | # File 'lib/tk.rb', line 2047
def ip_eval_with_enc(cmd_string)
  _ip_eval_core(true, cmd_string)
end | 
 
    
      
  
  
    #ip_eval_without_enc(cmd_string)  ⇒ Object 
  
  
  
  
    | 
2043
2044
2045 | # File 'lib/tk.rb', line 2043
def ip_eval_without_enc(cmd_string)
  _ip_eval_core(false, cmd_string)
end | 
 
    
      
  
  
    #ip_invoke(*args)  ⇒ Object 
  
  
  
  
    | 
2067
2068
2069 | # File 'lib/tk.rb', line 2067
def ip_invoke(*args)
  _ip_invoke_core(nil, *args)
end | 
 
    
      
  
  
    #ip_invoke_with_enc(*args)  ⇒ Object 
  
  
  
  
    | 
2075
2076
2077 | # File 'lib/tk.rb', line 2075
def ip_invoke_with_enc(*args)
  _ip_invoke_core(true, *args)
end | 
 
    
      
  
  
    #ip_invoke_without_enc(*args)  ⇒ Object 
  
  
  
  
    | 
2071
2072
2073 | # File 'lib/tk.rb', line 2071
def ip_invoke_without_enc(*args)
  _ip_invoke_core(false, *args)
end | 
 
    
      
    
      
  
  
    #load_cmd_on_ip(tk_cmd)  ⇒ Object 
  
  
  
  
    
def TkCore.callback(arg_str)
arg = tk_split_simplelist(arg_str)
begin
  TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg)
rescue Exception => e
  raise(e, e.class.inspect + ': ' + e.message + "\n" +
           "\n---< backtrace of Ruby side >-----\n" +
           e.backtrace.join("\n") +
           "\n---< backtrace of Tk side >-------")
end
#=begin #    cb_obj = TkCore::INTERP.tk_cmd_tbl #    unless $DEBUG #      cb_obj.call(*arg) #    else #      begin #       raise ‘check backtrace’ #      rescue #       # ignore backtrace before ‘callback’ #       pos = -($!.backtrace.size) #      end #      begin #       cb_obj.call(*arg) #      rescue #       trace = $!.backtrace #       raise $!, “n#0: #TkCore.$!$!.message (#TkCore.$!$!.class)n” + #                 “tfrom #.join(”ntfrom “)” #      end #    end #=end
end
   
 
  
  
    | 
1683
1684
1685 | # File 'lib/tk.rb', line 1683
def load_cmd_on_ip(tk_cmd)
  bool(tk_call('auto_load', tk_cmd))
end | 
 
    
      
  
  
    #mainloop(check_root = true)  ⇒ Object 
  
  
  
 
    
      
  
  
    #mainloop_exist?  ⇒ Boolean 
  
  
  
 
    
      
  
  
    #mainloop_thread?  ⇒ Boolean 
  
  
  
 
    
      
  
  
    #mainloop_watchdog(check_root = true)  ⇒ Object 
  
  
  
  
    | 
1936
1937
1938
1939 | # File 'lib/tk.rb', line 1936
def mainloop_watchdog(check_root = true)
    TclTkLib.mainloop_watchdog(check_root)
end | 
 
    
      
  
  
    #messageBox(keys)  ⇒ Object 
  
  
  
  
    | 
1997
1998
1999 | # File 'lib/tk.rb', line 1997
def messageBox(keys)
  tk_call('tk_messageBox', *hash_kv(keys))
end | 
 
    
      
  
  
    #rb_appsend(interp, async, *args)  ⇒ Object 
  
  
  
  
    | 
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817 | # File 'lib/tk.rb', line 1803
def rb_appsend(interp, async, *args)
  if $SAFE >= 1 && args.find{|obj| obj.tainted?}
    fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}"
  end
  if async != true && async != false && async != nil
    args.unshift(async)
    async = false
  end
    args = args.collect!{|c| _get_eval_string(c).gsub(/[\[\]$"\\]/, '\\\\\&')}
      args.push('}.call)"')
  appsend(interp, async, 'ruby "TkComm._get_eval_string(proc{', *args)
end | 
 
    
      
  
  
    #rb_appsend_displayof(interp, win, async, *args)  ⇒ Object 
  
  
  
  
    | 
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850 | # File 'lib/tk.rb', line 1835
def rb_appsend_displayof(interp, win, async, *args)
  if $SAFE >= 1 && args.find{|obj| obj.tainted?}
    fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}"
  end
  win = '.' if win == nil
  if async != true && async != false && async != nil
    args.unshift(async)
    async = false
  end
    args = args.collect!{|c| _get_eval_string(c).gsub(/[\[\]$"\\]/, '\\\\\&')}
      args.push('}.call)"')
  appsend(interp, win, async, 'ruby "TkComm._get_eval_string(proc{', *args)
end | 
 
    
      
  
  
    #reset_inactive  ⇒ Object 
  
  
  
  
    | 
1773
1774
1775 | # File 'lib/tk.rb', line 1773
def reset_inactive
  tk_call_without_enc('tk', 'inactive', 'reset')
end | 
 
    
      
  
  
    #reset_inactive_displayof(win)  ⇒ Object 
  
  
  
  
    | 
1776
1777
1778 | # File 'lib/tk.rb', line 1776
def reset_inactive_displayof(win)
  tk_call_without_enc('tk', 'inactive', '-displayof', win, 'reset')
end | 
 
    
      
  
  
    #restart(app_name = nil, keys = {})  ⇒ Object 
  
  
  
  
    | 
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980 | # File 'lib/tk.rb', line 1969
def restart(app_name = nil, keys = {})
  TkCore::INTERP.init_ip_internal
  tk_call('set', 'argv0', app_name) if app_name
  if keys.kind_of?(Hash)
        tk_call('set', 'argv', hash_kv(keys).join(' '))
  end
  INTERP.restart
  nil
end | 
 
    
      
  
  
    #scaling(scale = nil)  ⇒ Object 
  
  
  
  
    | 
1752
1753
1754
1755
1756
1757
1758 | # File 'lib/tk.rb', line 1752
def scaling(scale=nil)
  if scale
    tk_call_without_enc('tk', 'scaling', scale)
  else
    Float(number(tk_call_without_enc('tk', 'scaling')))
  end
end | 
 
    
      
  
  
    #scaling_displayof(win, scale = nil)  ⇒ Object 
  
  
  
  
    | 
1759
1760
1761
1762
1763
1764
1765 | # File 'lib/tk.rb', line 1759
def scaling_displayof(win, scale=nil)
  if scale
    tk_call_without_enc('tk', 'scaling', '-displayof', win, scale)
  else
    Float(number(tk_call_without_enc('tk', '-displayof', win, 'scaling')))
  end
end | 
 
    
      
  
  
    #set_eventloop_tick(timer_tick)  ⇒ Object 
  
  
  
 
    
      
  
  
    #set_eventloop_weight(loop_max, no_event_tick)  ⇒ Object 
  
  
  
  
    | 
1961
1962
1963 | # File 'lib/tk.rb', line 1961
def set_eventloop_weight(loop_max, no_event_tick)
  TclTkLib.set_eventloop_weight(loop_max, no_event_tick)
end | 
 
    
      
  
  
    #set_no_event_wait(wait)  ⇒ Object 
  
  
  
  
    | 
1953
1954
1955 | # File 'lib/tk.rb', line 1953
def set_no_event_wait(wait)
  TclTkLib.set_no_even_wait(wait)
end | 
 
    
      
  
  
    #tk_call(*args)  ⇒ Object 
  
  
  
  
    | 
2113
2114
2115 | # File 'lib/tk.rb', line 2113
def tk_call(*args)
  _tk_call_core(nil, *args)
end | 
 
    
      
  
  
    #tk_call_to_list(*args)  ⇒ Object 
  
  
  
  
    
private :_tk_call_to_list_core
   
 
  
  
    | 
2136
2137
2138 | # File 'lib/tk.rb', line 2136
def tk_call_to_list(*args)
  _tk_call_to_list_core(-1, nil, true, *args)
end | 
 
    
      
  
  
    #tk_call_to_list_with_enc(*args)  ⇒ Object 
  
  
  
  
    | 
2144
2145
2146 | # File 'lib/tk.rb', line 2144
def tk_call_to_list_with_enc(*args)
  _tk_call_to_list_core(-1, true, true, *args)
end | 
 
    
      
  
  
    #tk_call_to_list_without_enc(*args)  ⇒ Object 
  
  
  
  
    | 
2140
2141
2142 | # File 'lib/tk.rb', line 2140
def tk_call_to_list_without_enc(*args)
  _tk_call_to_list_core(-1, false, false, *args)
end | 
 
    
      
  
  
    #tk_call_to_simplelist(*args)  ⇒ Object 
  
  
  
  
    | 
2148
2149
2150 | # File 'lib/tk.rb', line 2148
def tk_call_to_simplelist(*args)
  _tk_call_to_list_core(0, nil, true, *args)
end | 
 
    
      
  
  
    #tk_call_to_simplelist_with_enc(*args)  ⇒ Object 
  
  
  
  
    | 
2156
2157
2158 | # File 'lib/tk.rb', line 2156
def tk_call_to_simplelist_with_enc(*args)
  _tk_call_to_list_core(0, true, true, *args)
end | 
 
    
      
  
  
    #tk_call_to_simplelist_without_enc(*args)  ⇒ Object 
  
  
  
  
    | 
2152
2153
2154 | # File 'lib/tk.rb', line 2152
def tk_call_to_simplelist_without_enc(*args)
  _tk_call_to_list_core(0, false, false, *args)
end | 
 
    
      
  
  
    #tk_call_with_enc(*args)  ⇒ Object 
  
  
  
  
    | 
2121
2122
2123 | # File 'lib/tk.rb', line 2121
def tk_call_with_enc(*args)
  _tk_call_core(true, *args)
end | 
 
    
      
  
  
    #tk_call_without_enc(*args)  ⇒ Object 
  
  
  
  
    | 
2117
2118
2119 | # File 'lib/tk.rb', line 2117
def tk_call_without_enc(*args)
  _tk_call_core(false, *args)
end | 
 
    
      
  
  
    #windowingsystem  ⇒ Object 
  
  
  
  
    | 
1748
1749
1750 | # File 'lib/tk.rb', line 1748
def windowingsystem
  tk_call_without_enc('tk', 'windowingsystem')
end |