Module: Tk

Extended by:
Tk, Encoding
Includes:
TkCore
Included in:
Tk, BLT::PlotComponent::Element, BLT::PlotComponent::Marker, BLT::Table, BLT::Table, BWidget::DragSite, BWidget::DragSite, BWidget::DropSite, BWidget::DropSite, BWidget::DynamicHelp, BWidget::DynamicHelp, BWidget::SelectColor, BWidget::SelectFont, BWidget::Widget, BWidget::Widget, Clock, ICONS, Itcl, Itcl, Itk, Itk, MacResource, TreeCtrl::BindCallback, TreeCtrl::BindCallback, WinDDE, WinRegistry, TkBgError, TkClipboard, TkClipboard, TkComposite, TkComposite, TkConsole, TkConsole, TkDialogObj, TkFont, TkFont::CoreMethods, TkGrid, TkGrid, TkImage, TkKinput, TkKinput, TkManageFocus, TkMsgCatalog, TkNamespace, TkNamespace::ScopeArgs, TkObject, TkOptionDB, TkOptionDB, TkPack, TkPack, TkPalette, TkPalette, TkPlace, TkPlace, TkSelection, TkSelection, TkVariable, TkVirtualEvent, TkWinfo, TkWinfo, TkXIM, TkXIM, TkcItem
Defined in:
lib/tk/autoload.rb,
lib/tk/wm.rb,
lib/tk/clock.rb,
sample/irbtk.rb,
lib/tk/tk_mac.rb,
lib/tk/macpkg.rb,
lib/tk/autoload.rb,
lib/tk/autoload.rb,
lib/tk/autoload.rb,
lib/tk/variable.rb,
lib/tkextlib/vu.rb,
lib/tk/optionobj.rb,
lib/tkextlib/blt.rb,
lib/tk/scrollable.rb,
lib/tk/encodedstr.rb,
lib/tk/validation.rb,
lib/tkextlib/tile.rb,
lib/tkextlib/tile.rb,
lib/tkextlib/tile.rb,
lib/tkextlib/tile.rb,
lib/tkextlib/tile.rb,
lib/tkextlib/tile.rb,
sample/tkcombobox.rb,
sample/tkalignbox.rb,
lib/tk/fontchooser.rb,
lib/tkextlib/tkDND.rb,
lib/tkextlib/tkimg.rb,
lib/tk/ttk_selector.rb,
lib/tkextlib/vu/pie.rb,
lib/tkextlib/tcllib.rb,
lib/tkextlib/bwidget.rb,
lib/tkextlib/version.rb,
lib/tkextlib/vu/dial.rb,
sample/tkballoonhelp.rb,
lib/tkextlib/iwidgets.rb,
lib/tkextlib/tkimg/ps.rb,
lib/tkextlib/tkimg/bmp.rb,
lib/tkextlib/tkimg/sgi.rb,
lib/tkextlib/tkimg/raw.rb,
lib/tkextlib/tkimg/xbm.rb,
lib/tkextlib/tkimg/png.rb,
lib/tkextlib/tkimg/sun.rb,
lib/tkextlib/tkimg/tga.rb,
lib/tkextlib/tkimg/gif.rb,
lib/tkextlib/tkimg/ppm.rb,
lib/tkextlib/tkimg/pcx.rb,
lib/tkextlib/tkimg/xpm.rb,
lib/tkextlib/tkimg/ico.rb,
lib/tkextlib/tclx/tclx.rb,
lib/tkextlib/vu/charts.rb,
lib/tkextlib/tile/style.rb,
lib/tkextlib/tkimg/dted.rb,
lib/tkextlib/tkimg/tiff.rb,
lib/tkextlib/tkimg/jpeg.rb,
lib/tkextlib/tcllib/ico.rb,
lib/tkextlib/vu/spinbox.rb,
sample/editable_listbox.rb,
lib/tkextlib/tile/tframe.rb,
lib/tkextlib/tile/tpaned.rb,
lib/tkextlib/tile/tlabel.rb,
lib/tkextlib/tile/tentry.rb,
lib/tkextlib/tile/dialog.rb,
lib/tkextlib/tile/tscale.rb,
lib/tkextlib/ICONS/icons.rb,
lib/tkextlib/itk/incr_tk.rb,
lib/tkextlib/trofs/trofs.rb,
lib/tkextlib/vu/bargraph.rb,
lib/tkextlib/tkDND/shape.rb,
lib/tkextlib/tkDND/tkdnd.rb,
lib/tkextlib/bwidget/tree.rb,
lib/tkextlib/tile/tsquare.rb,
lib/tkextlib/tile/tbutton.rb,
lib/tkextlib/tkimg/window.rb,
lib/tkextlib/tkimg/pixmap.rb,
lib/tkextlib/tcllib/ctext.rb,
lib/tkextlib/bwidget/label.rb,
lib/tkextlib/bwidget/entry.rb,
lib/tkextlib/winico/winico.rb,
lib/tkextlib/tile/tspinbox.rb,
lib/tkextlib/tile/treeview.rb,
lib/tkextlib/tile/sizegrip.rb,
lib/tkextlib/tcllib/cursor.rb,
lib/tkextlib/tcllib/cursor.rb,
lib/tkextlib/itcl/incr_tcl.rb,
sample/demos-en/tkencoding.rb,
lib/tkextlib/bwidget/widget.rb,
lib/tkextlib/bwidget/button.rb,
lib/tkextlib/bwidget/bitmap.rb,
lib/tkextlib/bwidget/dialog.rb,
lib/tkextlib/tile/tcombobox.rb,
lib/tkextlib/tile/tnotebook.rb,
lib/tkextlib/iwidgets/shell.rb,
lib/tkextlib/iwidgets/watch.rb,
lib/tkextlib/bwidget/listbox.rb,
lib/tkextlib/bwidget/spinbox.rb,
lib/tkextlib/tile/tseparator.rb,
lib/tkextlib/tile/tscrollbar.rb,
lib/tkextlib/tktable/tktable.rb,
lib/tkextlib/tcllib/ip_entry.rb,
lib/tkextlib/tktrans/tktrans.rb,
lib/tkextlib/iwidgets/tabset.rb,
lib/tkextlib/iwidgets/dialog.rb,
lib/tkextlib/bwidget/notebook.rb,
lib/tkextlib/bwidget/dropsite.rb,
lib/tkextlib/bwidget/dragsite.rb,
lib/tkextlib/bwidget/combobox.rb,
lib/tkextlib/tile/tlabelframe.rb,
lib/tkextlib/tile/tmenubutton.rb,
lib/tkextlib/tcllib/plotchart.rb,
lib/tkextlib/tcllib/datefield.rb,
lib/tkextlib/iwidgets/spinner.rb,
lib/tkextlib/iwidgets/toolbar.rb,
lib/tkextlib/iwidgets/spinint.rb,
lib/tkextlib/iwidgets/menubar.rb,
lib/tkextlib/bwidget/mainframe.rb,
lib/tkextlib/bwidget/passwddlg.rb,
lib/tkextlib/bwidget/separator.rb,
lib/tkextlib/bwidget/buttonbox.rb,
lib/tkextlib/bwidget/statusbar.rb,
lib/tkextlib/tile/tprogressbar.rb,
lib/tkextlib/tile/tcheckbutton.rb,
lib/tkextlib/tile/tradiobutton.rb,
lib/tkextlib/tcllib/tkpiechart.rb,
lib/tkextlib/tcllib/autoscroll.rb,
lib/tkextlib/tcllib/autoscroll.rb,
lib/tkextlib/tcllib/autoscroll.rb,
lib/tkextlib/iwidgets/checkbox.rb,
lib/tkextlib/iwidgets/feedback.rb,
lib/tkextlib/iwidgets/radiobox.rb,
lib/tkextlib/iwidgets/spintime.rb,
lib/tkextlib/iwidgets/notebook.rb,
lib/tkextlib/iwidgets/calendar.rb,
lib/tkextlib/iwidgets/spindate.rb,
lib/tkextlib/iwidgets/combobox.rb,
lib/tkextlib/tkHTML/htmlwidget.rb,
lib/tkextlib/bwidget/messagedlg.rb,
lib/tkextlib/bwidget/titleframe.rb,
lib/tkextlib/bwidget/labelframe.rb,
lib/tkextlib/bwidget/selectfont.rb,
lib/tkextlib/bwidget/labelentry.rb,
lib/tkextlib/bwidget/panelframe.rb,
lib/tkextlib/bwidget/scrollview.rb,
lib/tkextlib/iwidgets/dateentry.rb,
lib/tkextlib/iwidgets/timeentry.rb,
lib/tkextlib/iwidgets/extbutton.rb,
lib/tkextlib/iwidgets/hyperhelp.rb,
lib/tkextlib/iwidgets/buttonbox.rb,
lib/tkextlib/iwidgets/timefield.rb,
lib/tkextlib/iwidgets/datefield.rb,
lib/tkextlib/iwidgets/hierarchy.rb,
lib/tkextlib/treectrl/tktreectrl.rb,
lib/tkextlib/bwidget/progressdlg.rb,
lib/tkextlib/bwidget/progressbar.rb,
lib/tkextlib/bwidget/panedwindow.rb,
lib/tkextlib/bwidget/selectcolor.rb,
lib/tkextlib/bwidget/arrowbutton.rb,
lib/tkextlib/bwidget/dynamichelp.rb,
lib/tkextlib/iwidgets/optionmenu.rb,
lib/tkextlib/iwidgets/finddialog.rb,
lib/tkextlib/iwidgets/pushbutton.rb,
lib/tkextlib/iwidgets/mainwindow.rb,
lib/tkextlib/iwidgets/messagebox.rb,
lib/tkextlib/iwidgets/entryfield.rb,
lib/tkextlib/bwidget/pagesmanager.rb,
lib/tkextlib/iwidgets/panedwindow.rb,
lib/tkextlib/iwidgets/tabnotebook.rb,
lib/tkextlib/iwidgets/dialogshell.rb,
lib/tkextlib/tcllib/tablelist_core.rb,
lib/tkextlib/tcllib/tablelist_tile.rb,
lib/tkextlib/iwidgets/selectionbox.rb,
lib/tkextlib/iwidgets/labeledframe.rb,
lib/tkextlib/iwidgets/scrolledhtml.rb,
lib/tkextlib/iwidgets/scopedobject.rb,
lib/tkextlib/iwidgets/scrolledtext.rb,
lib/tkextlib/iwidgets/promptdialog.rb,
lib/tkextlib/bwidget/scrolledwindow.rb,
lib/tkextlib/iwidgets/messagedialog.rb,
lib/tkextlib/iwidgets/labeledwidget.rb,
lib/tkextlib/iwidgets/scrolledframe.rb,
lib/tkextlib/bwidget/scrollableframe.rb,
lib/tkextlib/iwidgets/canvasprintbox.rb,
lib/tkextlib/iwidgets/scrolledcanvas.rb,
lib/tkextlib/iwidgets/scrolledwidget.rb,
lib/tkextlib/iwidgets/scrolledlistbox.rb,
lib/tkextlib/iwidgets/selectiondialog.rb,
lib/tkextlib/iwidgets/disjointlistbox.rb,
lib/tkextlib/iwidgets/fileselectionbox.rb,
lib/tkextlib/iwidgets/canvasprintdialog.rb,
lib/tkextlib/iwidgets/extfileselectionbox.rb,
lib/tkextlib/iwidgets/fileselectiondialog.rb,
lib/tkextlib/iwidgets/extfileselectiondialog.rb,
lib/tk.rb,
lib/tk.rb,
lib/tk.rb,
lib/tk.rb,
lib/tk.rb

Overview

freeze core modules TclTkLib.freeze TclTkIp.freeze TkUtil.freeze TkKernel.freeze TkComm.freeze TkComm::Event.freeze TkCore.freeze Tk.freeze

Defined Under Namespace

Modules: BLT, BWidget, Busy, Clock, Encoding, Img, Itcl, ItemValidateConfigure, Itk, Iwidgets, Mac, MacResource, RbWidget, Scrollable, ScrollbarComposite, SystemMenu, TOPLEVEL_ALIASES, TclX, Tcllib, Tile, TkDND, TkTrans, Trofs, ValidateConfigure, Vu, WinDDE, WinRegistry, Wm, Wm_for_General, XScrollable, YScrollable Classes: BinaryString, Button, Canvas, CheckButton, EncodedString, Entry, Frame, HTML_Widget, ICONS, Label, LabelFrame, Listbox, Menu, MenuClone, Menubutton, Message, OptionMenubutton, OptionObj, PanedWindow, RadioButton, Root, Scale, Scrollbar, Spinbox, SysMenu_Apple, SysMenu_Help, SysMenu_System, Text, TkTable, Toplevel, TreeCtrl, UTF8_String, Winico, XScrollbar, YScrollbar

Constant Summary collapse

MAINLOOP =
Thread.new{ mainloop }
AUTO_PATH =
TkVarAccess.new('auto_path', auto_path)
TCL_PACKAGE_PATH =

AUTO_OLDPATH = tk_split_simplelist(INTERP._invoke(‘set’, ‘auto_oldpath’))

AUTO_OLDPATH.each{|s| s.freeze}
AUTO_OLDPATH.freeze
TkVarAccess.new('tcl_pkgPath')
PACKAGE_PATH =
TCL_PACKAGE_PATH
TCL_LIBRARY_PATH =
TkVarAccess.new('tcl_libPath')
LIBRARY_PATH =
TCL_LIBRARY_PATH
TCL_PRECISION =
TkVarAccess.new('tcl_precision')
X_Scrollable =
XScrollable
Y_Scrollable =
YScrollable
Fontchooser =
TkFont::Chooser
Tkextlib_RELEASE_DATE =
'2010-02-01'.freeze
INTERP =
TkCore::INTERP
TreeCtrl_Widget =
TreeCtrl
TCL_VERSION =
INTERP._invoke_without_enc("info", "tclversion").freeze
TCL_PATCHLEVEL =
INTERP._invoke_without_enc("info", "patchlevel").freeze
TCL_MAJOR_VERSION =
major.to_i
TCL_MINOR_VERSION =
minor.to_i
TK_VERSION =
INTERP._invoke_without_enc("set", "tk_version").freeze
TK_PATCHLEVEL =
INTERP._invoke_without_enc("set", "tk_patchLevel").freeze
TK_MAJOR_VERSION =
major.to_i
TK_MINOR_VERSION =
minor.to_i
JAPANIZED_TK =
(INTERP._invoke_without_enc("info", "commands",
"kanji") != "").freeze
RELEASE_DATE =
'2014-10-19'.freeze

Constants included from Encoding

Encoding::BINARY, Encoding::BINARY_NAME, Encoding::DEFAULT_EXTERNAL_NAME, Encoding::DEFAULT_INTERNAL_NAME, Encoding::ENCODING_TABLE, Encoding::RubyEncoding, Encoding::TkCommandNames, Encoding::UNKNOWN, Encoding::UTF8_NAME

Constants included from TkCore

TkCore::EventFlag, TkCore::INTERP_MUTEX, TkCore::INTERP_ROOT_CHECK, TkCore::INTERP_THREAD, TkCore::INTERP_THREAD_STATUS, TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD, TkCore::WIDGET_DESTROY_HOOK, TkCore::WITH_ENCODING, TkCore::WITH_RUBY_VM

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Encoding

default_encoding=, encoding_convertfrom, encoding_convertto, encoding_dirs, encoding_dirs=, encoding_name, encoding_names, encoding_obj, encoding_objs, encoding_system=, encoding_system_name, encoding_system_obj, force_default_encoding, force_default_encoding=, force_default_encoding?, tk_encoding_names

Methods included from TkCore

#_tk_call_to_list_core, #after, #after_cancel, #after_idle, #appname, #appsend, #appsend_deny, #appsend_displayof, callback, #callback_break, #callback_continue, #callback_return, #chooseColor, #chooseDirectory, #do_one_event, #event_generate, #getMultipleOpenFile, #getMultipleSaveFile, #getOpenFile, #getSaveFile, #get_eventloop_tick, #get_eventloop_weight, #get_no_event_wait, #inactive, #inactive_displayof, #info, #ip_eval, #ip_eval_with_enc, #ip_eval_without_enc, #ip_invoke, #ip_invoke_with_enc, #ip_invoke_without_enc, #is_mainloop?, #load_cmd_on_ip, #mainloop, #mainloop_exist?, #mainloop_thread?, #mainloop_watchdog, #messageBox, #rb_appsend, #rb_appsend_displayof, #reset_inactive, #reset_inactive_displayof, #restart, #scaling, #scaling_displayof, #set_eventloop_tick, #set_eventloop_weight, #set_no_event_wait, #tk_call, #tk_call_to_list, #tk_call_to_list_with_enc, #tk_call_to_list_without_enc, #tk_call_to_simplelist, #tk_call_to_simplelist_with_enc, #tk_call_to_simplelist_without_enc, #tk_call_with_enc, #tk_call_without_enc, #windowingsystem

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 TkEvent

#install_bind, #install_bind_for_event_class

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, callback, 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

Class Method Details

.__create_widget_set__(new_set, src_set = {}) ⇒ Object



722
723
724
725
726
727
728
729
730
731
732
733
734
# File 'lib/tk/autoload.rb', line 722

def __create_widget_set__(new_set, src_set={})
  new_set = new_set.to_sym
  if @TOPLEVEL_ALIAS_TABLE[new_set]
    fail RuntimeError, "A widget-set #{new_set.inspect} is already exist."
  end
  if src_set.kind_of?(Symbol)
    # new_set is an alias name of existed widget set.
    @TOPLEVEL_ALIAS_TABLE[new_set] = @TOPLEVEL_ALIAS_TABLE[src_set]
  else
    @TOPLEVEL_ALIAS_TABLE[new_set] = {}
    src_set.each{|sym, obj| set_topalias(new_set, obj, sym.to_sym) }
  end
end

.__disable_toplevel_control__(*symbols) ⇒ Object



718
719
720
# File 'lib/tk/autoload.rb', line 718

def __disable_toplevel_control__(*symbols)
  symbols.each{|sym| @TOPLEVEL_ALIAS_OWNER[sym.to_sym] = false}
end

.__import_toplevel_aliases__(target, *symbols) ⇒ Object



669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
# File 'lib/tk/autoload.rb', line 669

def __import_toplevel_aliases__(target, *symbols)
  current = @current_default_widget_set
  symbols.each{|sym|
    sym = sym.to_sym
    if (obj = @TOPLEVEL_ALIAS_TABLE[target][sym]).nil?
      # remove
      @TOPLEVEL_ALIAS_TABLE[current].delete(sym)
      @TOPLEVEL_ALIAS_OWNER.delete(sym)
      Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym)
      Object.class_eval{remove_const sym} if topobj_defined?(sym)

    elsif obj == false
      # remove, but OWNER[sym] <- false and not treat Object::sym
      @TOPLEVEL_ALIAS_TABLE[current].delete(sym)
      @TOPLEVEL_ALIAS_OWNER[sym] = false
      Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym)

    elsif @TOPLEVEL_ALIAS_OWNER[sym] == false
      # Object::sym is out of control. --> not change
      # Keep OWNER[sym].
      @TOPLEVEL_ALIAS_TABLE[current][sym] = obj
      replace_topalias(sym, obj)

    else
      # new definition under control
      @TOPLEVEL_ALIAS_OWNER[sym] = current
      @TOPLEVEL_ALIAS_TABLE[current][sym] = obj
      replace_topalias(sym, obj)
      replace_topobj(sym, obj)
    end
  }
end

.__regist_toplevel_aliases__(target, obj, *symbols) ⇒ Object



436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/tk/autoload.rb', line 436

def __regist_toplevel_aliases__(target, obj, *symbols)
  # initial regist
  @TOPLEVEL_ALIAS_TABLE[target = target.to_sym] ||= {}
  symbols.each{|sym|
    @TOPLEVEL_ALIAS_TABLE[target][sym = sym.to_sym] = obj
    if !topalias_defined?(sym) || target == @current_default_widget_set
      @TOPLEVEL_ALIAS_OWNER[sym] = target
      replace_topalias(sym, obj)
      replace_topobj(sym, obj) unless obj.kind_of?(String) # NOT autoload
    end
  }
end

.__remove_toplevel_aliases__(*symbols) ⇒ Object



702
703
704
705
706
707
708
709
710
711
712
# File 'lib/tk/autoload.rb', line 702

def __remove_toplevel_aliases__(*symbols)
  # remove toplevel aliases of current widget set
  current = @current_default_widget_set
  symbols.each{|sym|
    sym = sym.to_sym
    @TOPLEVEL_ALIAS_TABLE[current].delete(sym)
    @TOPLEVEL_ALIAS_OWNER.delete(sym)
    Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym)
    Object.class_eval{remove_const sym} if topobj_defined?(sym)
  }
end

.__reset_toplevel_owner__(*symbols) ⇒ Object



714
715
716
# File 'lib/tk/autoload.rb', line 714

def __reset_toplevel_owner__(*symbols)
  symbols.each{|sym| @TOPLEVEL_ALIAS_OWNER.delete(sym.to_sym)}
end

.__set_loaded_toplevel_aliases__(autopath, target, obj, *symbols) ⇒ Object



586
587
588
589
590
591
592
593
594
595
596
# File 'lib/tk/autoload.rb', line 586

def __set_loaded_toplevel_aliases__(autopath, target, obj, *symbols)
  # autopath is an autoload file
  # Currently, this method doesn't support that autoload loads
  # different toplevels between <basename>.rb and <basename>.so extension.
  shortpath = (autopath =~ /^(.*)(.rb|.so)$/)? $1: autopath
  target = target.to_sym
  symbols.map!{|sym| sym.to_sym}

  symbols.each{|sym| regist_sym_for_loaded_file(shortpath, obj, sym) }
  symbols.each{|sym| set_topalias(target, obj, sym)}
end

.__set_toplevel_aliases__(target, obj, *symbols) ⇒ Object



579
580
581
582
583
584
# File 'lib/tk/autoload.rb', line 579

def __set_toplevel_aliases__(target, obj, *symbols)
  # obj is a kind of String : define autoload path
  #                  Class  : use the class object
  target = target.to_sym
  symbols.each{|sym| set_topalias(target, obj, sym.to_sym)}
end

.__toplevel_alias_setup_proc__(*target_list, &cmd) ⇒ Object



369
370
371
# File 'lib/tk/autoload.rb', line 369

def __toplevel_alias_setup_proc__(*target_list, &cmd)
  target_list.each{|target| @TOPLEVEL_ALIAS_SETUP_PROC[target.to_sym] = cmd}
end

._replace_toplevel_aliases(target) ⇒ Object



643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
# File 'lib/tk/autoload.rb', line 643

def _replace_toplevel_aliases(target)
  # backup
  @TOPLEVEL_ALIAS_TABLE[target].each_key{|sym|
    backup_current_topdef(sym)
  }

  # replace
  @TOPLEVEL_ALIAS_TABLE[target].each_key{|sym|
    next if (obj = @TOPLEVEL_ALIAS_TABLE[target][sym]).nil?
    if @TOPLEVEL_ALIAS_OWNER[sym] == false
      # Object::sym is out of control. --> not change
      # Keep OWNER[sym].
      replace_topalias(sym, obj)
    else
      # New definition
      @TOPLEVEL_ALIAS_OWNER[sym] = target
      replace_topalias(sym, obj)
      replace_topobj(sym, obj)
    end
  }

  # change default_widget_set
  @current_default_widget_set = target
end

.add_kinsoku(chars, mode = 'both') ⇒ Object



2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
# File 'lib/tk.rb', line 2539

def Tk.add_kinsoku(chars, mode='both')
  begin
    if /^8\.*/ === TK_VERSION  && JAPANIZED_TK
      tk_split_simplelist(tk_call('kinsoku', 'add', mode,
                                  *(chars.split(''))))
    else
      []
    end
  rescue
    []
  end
end

.backup_current_topdef(sym) ⇒ Object



598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# File 'lib/tk/autoload.rb', line 598

def backup_current_topdef(sym)
  return if (current = @current_default_widget_set).nil?

  case @TOPLEVEL_ALIAS_OWNER[sym]
  when false
    # Object::sym is out of control.
    if (cur_alias = topalias_defined?(sym)) && ! cur_alias.kind_of?(String)
      @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias
    end

  when current
    if cur_obj = topobj_defined?(sym)
      if ! cur_obj.kind_of?(String) && (cur_alias = topalias_defined?(sym))
        if cur_alias.kind_of?(String)
          # Mayby, user replaced Object::sym.
          # Make Object::sym out of control.
          @TOPLEVEL_ALIAS_OWNER[sym] = false
        elsif cur_obj == cur_alias
          # Possibley, defined normally. Backup it
          @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias
        else
          # Mayby, user replaced Object::sym.
          # Make Object::sym out of control.
          @TOPLEVEL_ALIAS_OWNER[sym] = false
        end
      end
    else
      # Mayby, user replaced Object::sym.
      # Make Object::sym out of control.
      @TOPLEVEL_ALIAS_OWNER[sym] = false
    end

  when nil
    # Object::sym is out of control.
    if (cur_alias = topalias_defined?(sym)) && ! cur_alias.kind_of?(String)
      # Possibley, defined normally. Backup it.
      @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias
    end
  else
    # No authority to control Object::sym and ALIASES::sym.
    # Do nothing.
  end
end

.bell(nice = false) ⇒ Object



2367
2368
2369
2370
2371
2372
2373
2374
# File 'lib/tk.rb', line 2367

def Tk.bell(nice = false)
  if nice
    tk_call_without_enc('bell', '-nice')
  else
    tk_call_without_enc('bell')
  end
  nil
end

.bell_on_display(win, nice = false) ⇒ Object



2376
2377
2378
2379
2380
2381
2382
2383
# File 'lib/tk.rb', line 2376

def Tk.bell_on_display(win, nice = false)
  if nice
    tk_call_without_enc('bell', '-displayof', win, '-nice')
  else
    tk_call_without_enc('bell', '-displayof', win)
  end
  nil
end

.BinaryString(str) ⇒ Object



114
# File 'lib/tk/autoload.rb', line 114

def Tk.BinaryString(str); Tk::BinaryString.new(str); end

.const_missing(sym) ⇒ Object



2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
# File 'lib/tk.rb', line 2190

def Tk.const_missing(sym)
  case(sym)
  when :TCL_LIBRARY
    INTERP._invoke_without_enc('global', 'tcl_library')
    INTERP._invoke("set", "tcl_library").freeze

  when :TK_LIBRARY
    INTERP._invoke_without_enc('global', 'tk_library')
    INTERP._invoke("set", "tk_library").freeze

  when :LIBRARY
    INTERP._invoke("info", "library").freeze

  #when :PKG_PATH, :PACKAGE_PATH, :TCL_PACKAGE_PATH
  #  INTERP._invoke_without_enc('global', 'tcl_pkgPath')
  #  tk_split_simplelist(INTERP._invoke('set', 'tcl_pkgPath'))

  #when :LIB_PATH, :LIBRARY_PATH, :TCL_LIBRARY_PATH
  #  INTERP._invoke_without_enc('global', 'tcl_libPath')
  #  tk_split_simplelist(INTERP._invoke('set', 'tcl_libPath'))

  when :PLATFORM, :TCL_PLATFORM
    if $SAFE >= 4
      fail SecurityError, "can't get #{sym} when $SAFE >= 4"
    end
    INTERP._invoke_without_enc('global', 'tcl_platform')
    Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get',
                                                         'tcl_platform'))]

  when :ENV
    INTERP._invoke_without_enc('global', 'env')
    Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'env'))]

  #when :AUTO_PATH   #<===
  #  tk_split_simplelist(INTERP._invoke('set', 'auto_path'))

  #when :AUTO_OLDPATH
  #  tk_split_simplelist(INTERP._invoke('set', 'auto_oldpath'))

  when :AUTO_INDEX
    INTERP._invoke_without_enc('global', 'auto_index')
    Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'auto_index'))]

  when :PRIV, :PRIVATE, :TK_PRIV
    priv = {}
    if INTERP._invoke_without_enc('info', 'vars', 'tk::Priv') != ""
      var_nam = 'tk::Priv'
    else
      var_nam = 'tkPriv'
    end
    INTERP._invoke_without_enc('global', var_nam)
    Hash[*tk_split_simplelist(INTERP._invoke('array', 'get',
                                             var_nam))].each{|k,v|
      k.freeze
      case v
      when /^-?\d+$/
        priv[k] = v.to_i
      when /^-?\d+\.?\d*(e[-+]?\d+)?$/
        priv[k] = v.to_f
      else
        priv[k] = v.freeze
      end
    }
    priv

  else
    raise NameError, 'uninitialized constant Tk::' + sym.id2name
  end
end

.current_grabs(win = nil) ⇒ Object



2491
2492
2493
2494
2495
2496
2497
# File 'lib/tk.rb', line 2491

def Tk.current_grabs(win = nil)
  if win
    window(tk_call_without_enc('grab', 'current', win))
  else
    tk_split_list(tk_call_without_enc('grab', 'current'))
  end
end

.cursor_display(parent = None) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/tkextlib/tcllib/cursor.rb', line 46

def self.cursor_display(parent=None)
  # Pops up a dialog with a listbox containing all the cursor names.
  # Selecting a cursor name will display it in that dialog.
  # This is simply for viewing any available cursors on the platform .
  #tk_call_without_enc('::cursor::display', parent)
  Tk::Tcllib::Cursor.cursor_display(parent)
end

.default_widget_setObject



342
343
344
# File 'lib/tk/autoload.rb', line 342

def default_widget_set
  @current_default_widget_set
end

.default_widget_set=(target) ⇒ Object



346
347
348
349
350
351
352
353
354
355
# File 'lib/tk/autoload.rb', line 346

def default_widget_set=(target)
  target = target.to_sym
  return target if target == @current_default_widget_set

  if (cmd = @TOPLEVEL_ALIAS_SETUP_PROC[target])
    cmd.call(target)
  end

  _replace_toplevel_aliases(target)
end

.define_topalias(sym, obj) ⇒ Object



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/tk/autoload.rb', line 400

def define_topalias(sym, obj)
  if obj.kind_of? String
    # obj is an autoload path
    Tk::TOPLEVEL_ALIASES.autoload(sym, obj)
    unless Tk::TOPLEVEL_ALIASES.autoload?(sym)
      # file is autoloaded?
      if @AUTOLOAD_FILE_SYM_TABLE.has_key?(obj) &&
          (loaded_obj = @AUTOLOAD_FILE_SYM_TABLE[obj][sym])
        Tk::TOPLEVEL_ALIASES.const_set(sym, loaded_obj)
      else
        fail ArgumentError, "cannot define autoload file (already loaded?)"
      end
    end
  else
    # object
    Tk::TOPLEVEL_ALIASES.const_set(sym, obj)
  end
end

.define_topobj(sym, obj) ⇒ Object



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/tk/autoload.rb', line 382

def define_topobj(sym, obj)
  if obj.kind_of? String
    # obj is an autoload path
    Object.autoload(sym, obj)
    unless Object.autoload?(sym)
      # file is autoloaded?
      if @AUTOLOAD_FILE_SYM_TABLE.has_key?(obj) &&
          (loaded_obj = @AUTOLOAD_FILE_SYM_TABLE[obj][sym])
        Object.const_set(sym, loaded_obj)
      else
        fail ArgumentError, "cannot define autoload file (already loaded?)"
      end
    end
  else
    # object
    Object.const_set(sym, obj)
  end
end

.delete_kinsoku(chars, mode = 'both') ⇒ Object



2551
2552
2553
2554
2555
2556
2557
2558
2559
# File 'lib/tk.rb', line 2551

def Tk.delete_kinsoku(chars, mode='both')
  begin
    if /^8\.*/ === TK_VERSION  && JAPANIZED_TK
      tk_split_simplelist(tk_call('kinsoku', 'delete', mode,
                          *(chars.split(''))))
    end
  rescue
  end
end

.destroy(*wins) ⇒ Object



2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
# File 'lib/tk.rb', line 2385

def Tk.destroy(*wins)
  #tk_call_without_enc('destroy', *wins)
  tk_call_without_enc('destroy', *(wins.collect{|win|
                                     if win.kind_of?(TkWindow)
                                       win.epath
                                     else
                                       win
                                     end
                                   }))
end

.EncodedString(str, enc = nil) ⇒ Object



111
# File 'lib/tk/autoload.rb', line 111

def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end

.errorCodeObject



2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
# File 'lib/tk.rb', line 2265

def Tk.errorCode
  INTERP._invoke_without_enc('global', 'errorCode')
  code = tk_split_simplelist(INTERP._invoke_without_enc('set', 'errorCode'))
  case code[0]
  when 'CHILDKILLED', 'CHILDSTATUS', 'CHILDSUSP'
    begin
      pid = Integer(code[1])
      code[1] = pid
    rescue
    end
  end
  code
end

.errorInfoObject



2260
2261
2262
2263
# File 'lib/tk.rb', line 2260

def Tk.errorInfo
  INTERP._invoke_without_enc('global', 'errorInfo')
  INTERP._invoke_without_enc('set', 'errorInfo')
end

.exitObject



2396
2397
2398
# File 'lib/tk.rb', line 2396

def Tk.exit
  TkCore::INTERP.has_mainwindow? && tk_call_without_enc('destroy', '.')
end

.focus(display = nil) ⇒ Object



2499
2500
2501
2502
2503
2504
2505
# File 'lib/tk.rb', line 2499

def Tk.focus(display=nil)
  if display == nil
    window(tk_call_without_enc('focus'))
  else
    window(tk_call_without_enc('focus', '-displayof', display))
  end
end

.focus_lastfor(win) ⇒ Object



2515
2516
2517
# File 'lib/tk.rb', line 2515

def Tk.focus_lastfor(win)
  window(tk_call_without_enc('focus', '-lastfor', win))
end

.focus_next(win) ⇒ Object



2519
2520
2521
# File 'lib/tk.rb', line 2519

def Tk.focus_next(win)
  TkManageFocus.next(win)
end

.focus_prev(win) ⇒ Object



2523
2524
2525
# File 'lib/tk.rb', line 2523

def Tk.focus_prev(win)
  TkManageFocus.prev(win)
end

.focus_to(win, force = false) ⇒ Object



2507
2508
2509
2510
2511
2512
2513
# File 'lib/tk.rb', line 2507

def Tk.focus_to(win, force=false)
  if force
    tk_call_without_enc('focus', '-force', win)
  else
    tk_call_without_enc('focus', win)
  end
end

.fromUTF8(str, encoding = nil) ⇒ Object



2565
2566
2567
# File 'lib/tk.rb', line 2565

def Tk.fromUTF8(str, encoding = nil)
  _fromUTF8(str, encoding)
end

.grid(*args) ⇒ Object



2431
2432
2433
# File 'lib/tk.rb', line 2431

def Tk.grid(*args)
  TkGrid.configure(*args)
end

.grid_forget(*args) ⇒ Object



2434
2435
2436
# File 'lib/tk.rb', line 2434

def Tk.grid_forget(*args)
  TkGrid.forget(*args)
end

.has_mainwindow?Boolean

Returns:

  • (Boolean)


2279
2280
2281
# File 'lib/tk.rb', line 2279

def Tk.has_mainwindow?
  INTERP.has_mainwindow?
end

.load_tcllibrary(file, pkg_name = None, interp = None) ⇒ Object



2296
2297
2298
# File 'lib/tk.rb', line 2296

def Tk.load_tcllibrary(file, pkg_name=None, interp=None)
  tk_call('load', file, pkg_name, interp)
end

.load_tclscript(file, enc = nil) ⇒ Object



2287
2288
2289
2290
2291
2292
2293
2294
# File 'lib/tk.rb', line 2287

def Tk.load_tclscript(file, enc=nil)
  if enc
    # TCL_VERSION >= 8.5
    tk_call('source', '-encoding', enc, file)
  else
    tk_call('source', file)
  end
end

.load_tclscript_rsrc(resource_name, file = None) ⇒ Object



12
13
14
15
# File 'lib/tk/macpkg.rb', line 12

def Tk.load_tclscript_rsrc(resource_name, file=None)
  # Mac only
  tk_call('source', '-rsrc', resource_name, file)
end

.load_tclscript_rsrcid(resource_id, file = None) ⇒ Object



17
18
19
20
# File 'lib/tk/macpkg.rb', line 17

def Tk.load_tclscript_rsrcid(resource_id, file=None)
  # Mac only
  tk_call('source', '-rsrcid', resource_id, file)
end

.lower_window(win, below = None) ⇒ Object



2482
2483
2484
2485
# File 'lib/tk.rb', line 2482

def Tk.lower_window(win, below=None)
  tk_call('lower', _epath(win), _epath(below))
  nil
end

.pack(*args) ⇒ Object



2421
2422
2423
# File 'lib/tk.rb', line 2421

def Tk.pack(*args)
  TkPack.configure(*args)
end

.pack_forget(*args) ⇒ Object



2424
2425
2426
# File 'lib/tk.rb', line 2424

def Tk.pack_forget(*args)
  TkPack.forget(*args)
end

.pkgconfig_get(mod, key) ⇒ Object



2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
# File 'lib/tk.rb', line 2330

def Tk.pkgconfig_get(mod, key)
  # Tk8.5 feature
  if mod.kind_of?(Module)
    if mod.respond_to?(:package_name)
      pkgname = mod.package_name
    else
      fail NotImplementedError, 'may not be a module for a Tcl extension'
    end
  else
    pkgname = mod.to_s
  end

  pkgname = '::' << pkgname unless pkgname =~ /^::/

  tk_call(pkgname + '::pkgconfig', 'get', key)
end

.pkgconfig_list(mod) ⇒ Object



2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
# File 'lib/tk.rb', line 2311

def Tk.pkgconfig_list(mod)
  # Tk8.5 feature
  if mod.kind_of?(Module)
    if mod.respond_to?(:package_name)
      pkgname = mod.package_name
    elsif mod.const_defined?(:PACKAGE_NAME)
      pkgname = mod::PACKAGE_NAME
    else
      fail NotImplementedError, 'may not be a module for a Tcl extension'
    end
  else
    pkgname = mod.to_s
  end

  pkgname = '::' << pkgname unless pkgname =~ /^::/

  tk_split_list(tk_call(pkgname + '::pkgconfig', 'list'))
end

.place(*args) ⇒ Object



2441
2442
2443
# File 'lib/tk.rb', line 2441

def Tk.place(*args)
  TkPlace.configure(*args)
end

.place_forget(*args) ⇒ Object



2444
2445
2446
# File 'lib/tk.rb', line 2444

def Tk.place_forget(*args)
  TkPlace.forget(*args)
end

.raise_window(win, above = None) ⇒ Object



2486
2487
2488
2489
# File 'lib/tk.rb', line 2486

def Tk.raise_window(win, above=None)
  tk_call('raise', _epath(win), _epath(above))
  nil
end

.regist_sym_for_loaded_file(auto, obj, sym) ⇒ Object



449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/tk/autoload.rb', line 449

def regist_sym_for_loaded_file(auto, obj, sym)
  @AUTOLOAD_FILE_SYM_TABLE[auto][sym] = obj

  reg = /^#{Regexp.quote(auto)}(\.rb|\.so|)$/
  @TOPLEVEL_ALIAS_TABLE.each_key{|set|
    if @TOPLEVEL_ALIAS_TABLE[set][sym] =~ reg
      @TOPLEVEL_ALIAS_TABLE[set][sym] = obj
      if @TOPLEVEL_ALIAS_OWNER[sym].nil? || @TOPLEVEL_ALIAS_OWNER[sym] == set
        replace_topalias(sym, obj)
        replace_topobj(sym, obj) if set == @current_default_widget_set
      end
    end
  }
  if (f = Object.autoload?(sym)) && f =~ reg
    replace_topobj(sym, obj)
  end
  if (f = Tk::TOPLEVEL_ALIASES.autoload?(sym)) && f =~ reg
    replace_topalias(sym, obj)
  end
end

.replace_topalias(sym, obj) ⇒ Object

> old_obj (alias_filename or object) or nil



425
426
427
428
429
430
431
# File 'lib/tk/autoload.rb', line 425

def replace_topalias(sym, obj) #=> old_obj (alias_filename or object) or nil
  if old_obj = topalias_defined?(sym)
    Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} rescue nil #ignore err
  end
  define_topalias(sym, obj)
  old_obj
end

.replace_topobj(sym, obj) ⇒ Object

> old_obj (alias_filename or object) or nil



418
419
420
421
422
423
424
# File 'lib/tk/autoload.rb', line 418

def replace_topobj(sym, obj) #=> old_obj (alias_filename or object) or nil
  if old_obj = topobj_defined?(sym)
    Object.class_eval{remove_const sym} rescue nil # ignore err
  end
  define_topobj(sym, obj)
  old_obj
end

.set_topalias(target, obj, sym) ⇒ Object



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/tk/autoload.rb', line 471

def set_topalias(target, obj, sym)
  # obj is a kind of String : define autoload path
  #                  Class  : use the class object
  if target == @current_default_widget_set
    case @TOPLEVEL_ALIAS_OWNER[sym]
    when false
      # Object::sym is out of control. --> not change
      # Make ALIAS::sym under control, because target widget set is current.
      # Keep OWNER[sym]
      @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
      replace_topalias(sym, obj)

    when target
      if current_obj = topobj_defined?(sym)
        if current_obj == obj
          # Make current_obj under control.
          # Keep Object::sym.
          # Keep OWNER[sym].
          @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
          replace_topalias(sym, obj)

        else # current_obj != obj
          if current_obj == topalias_defined?(sym)
            # Change controlled object
            # Keep OWNER[sym].
            @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
            replace_topalias(sym, obj)
            replace_topobj(sym, obj)

          else # current_obj != topalias_defined?(sym)
            # Maybe current_obj is defined by user. --> OWNER[sym] = faise
            # Keep Object::sym.
            @TOPLEVEL_ALIAS_OWNER[sym] = false
            @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
            replace_topalias(sym, obj)
          end
        end

      else # NOT topobj_defined?(sym)
        # New definition for sym at target.
        # Keep OWNER[sym].
        @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
        replace_topalias(sym, obj)
        define_topobj(sym, obj)
      end

    when nil
      # New definition for sym at target.
      @TOPLEVEL_ALIAS_OWNER[sym] = target
      @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
      replace_topalias(sym, obj)

    else # others
      # Maybe planning to make sym under control.
      @TOPLEVEL_ALIAS_OWNER[sym] = target
      @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
      replace_topalias(sym, obj)
      replace_topobj(sym, obj)
    end

  else # target != @current_default_widget_set
    case @TOPLEVEL_ALIAS_OWNER[sym]
    when false
      # Object::sym is out of control. --> not change
      if topalias_defined?(sym)
        # ALIAS[sym] may be defined by other widget set.
        # Keep Object::sym (even if it is not defined)
        # Keep ALIAS[sym].
        # Keep OWNER[sym].
        @TOPLEVEL_ALIAS_TABLE[target][sym] = obj

      else # NOT topalias_defined?(sym)
        # Nobody controls ALIAS[sym].
        # At leaset, current widget set doesn't control ALIAS[sym].
        # Keep Object::sym (even if it is not defined)
        # Keep OWNER[sym].
        @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
        define_topalias(sym, obj)
      end

    when target
      # Maybe change controlled object, because Object::sym is under control.
      # Keep OWNER[sym].
      @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
      replace_topalias(sym, obj)
      replace_topobj(sym, obj)

    when nil
      # New definition for sym
      @TOPLEVEL_ALIAS_OWNER[sym] = target
      @TOPLEVEL_ALIAS_TABLE[target][sym] = obj
      replace_topalias(sym, obj)
      replace_topobj(sym, obj)

    else # others
      # An other widget set controls sym.
      # Keep Object::sym (even if it is not defined)
      # Keep ALIAS[sym].
      # Keep OWNER[sym].
      @TOPLEVEL_ALIAS_TABLE[target][sym] = obj

    end
  end

  sym
end

.show_kinsoku(mode = 'both') ⇒ Object



2531
2532
2533
2534
2535
2536
2537
2538
# File 'lib/tk.rb', line 2531

def Tk.show_kinsoku(mode='both')
  begin
    if /^8\.*/ === TK_VERSION  && JAPANIZED_TK
      tk_split_simplelist(tk_call('kinsoku', 'show', mode))
    end
  rescue
  end
end

.sleep(ms = nil, id = nil) ⇒ Object



2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
# File 'lib/tk.rb', line 2402

def Tk.sleep(ms = nil, id = nil)
  if id
    var = (id.kind_of?(TkVariable))? id: TkVarAccess.new(id.to_s)
  else
    var = TkVariable.new
  end

  var.value = tk_call_without_enc('after', ms, proc{ var.value = 0 }) if ms
  var.thread_wait
  ms
end

.strictMotif(mode = None) ⇒ Object



2527
2528
2529
# File 'lib/tk.rb', line 2527

def Tk.strictMotif(mode=None)
  bool(tk_call_without_enc('set', 'tk_strictMotif', mode))
end

.subst_tk_backslash(str) ⇒ Object



2577
2578
2579
# File 'lib/tk.rb', line 2577

def Tk.subst_tk_backslash(str)
  Tk::EncodedString.subst_tk_backslash(str)
end

.subst_utf_backslash(str) ⇒ Object



2574
2575
2576
# File 'lib/tk.rb', line 2574

def Tk.subst_utf_backslash(str)
  Tk::EncodedString.subst_utf_backslash(str)
end

.tcl_pkgconfig_get(key) ⇒ Object



2352
2353
2354
2355
# File 'lib/tk.rb', line 2352

def Tk.tcl_pkgconfig_get(key)
  # Tk8.5 feature
  Tk.pkgconfig_get('::tcl', key)
end

.tcl_pkgconfig_listObject



2347
2348
2349
2350
# File 'lib/tk.rb', line 2347

def Tk.tcl_pkgconfig_list
  # Tk8.5 feature
  Tk.pkgconfig_list('::tcl')
end

.thread_update(idle = nil) ⇒ Object

NOTE

If no eventloop-thread is running, “thread_update” method is same to “update” method. Else, “thread_update” method waits to complete idletask operation on the eventloop-thread.



2471
2472
2473
2474
2475
2476
2477
# File 'lib/tk.rb', line 2471

def Tk.thread_update(idle=nil)
  if idle
    tk_call_without_enc('thread_update', 'idletasks')
  else
    tk_call_without_enc('thread_update')
  end
end

.thread_update_idletasksObject



2478
2479
2480
# File 'lib/tk.rb', line 2478

def Tk.thread_update_idletasks
  thread_update(true)
end

.tk_pkgconfig_get(key) ⇒ Object



2362
2363
2364
2365
# File 'lib/tk.rb', line 2362

def Tk.tk_pkgconfig_get(key)
  # Tk8.5 feature
  Tk.pkgconfig_get('::tk', key)
end

.tk_pkgconfig_listObject



2357
2358
2359
2360
# File 'lib/tk.rb', line 2357

def Tk.tk_pkgconfig_list
  # Tk8.5 feature
  Tk.pkgconfig_list('::tk')
end

.to_backslash_sequence(str) ⇒ Object



2586
2587
2588
# File 'lib/tk.rb', line 2586

def Tk.to_backslash_sequence(str)
  Tk::EncodedString.to_backslash_sequence(str)
end

.topalias_defined?(sym) ⇒ Boolean

> alias_filename or object or false

Returns:

  • (Boolean)


377
378
379
380
381
# File 'lib/tk/autoload.rb', line 377

def topalias_defined?(sym) #=> alias_filename or object or false
  Tk::TOPLEVEL_ALIASES.autoload?(sym) ||
    (Tk::TOPLEVEL_ALIASES.const_defined?(sym) &&
       Tk::TOPLEVEL_ALIASES.const_get(sym))
end

.toplevel_aliases_on_widget_set(widget_set) ⇒ Object



361
362
363
364
365
366
367
# File 'lib/tk/autoload.rb', line 361

def toplevel_aliases_on_widget_set(widget_set)
  if (tbl = @TOPLEVEL_ALIAS_TABLE[widget_set.to_sym])
    tbl.collect{|k, v| (v.nil?)? nil: k}.compact
  else
    fail ArgumentError, "unknown widget_set #{widget_set.to_sym.inspect}"
  end
end

.topobj_defined?(sym) ⇒ Boolean

> alias_filename or object or false

Returns:

  • (Boolean)


373
374
375
376
# File 'lib/tk/autoload.rb', line 373

def topobj_defined?(sym) #=> alias_filename or object or false
  Object.autoload?(sym) ||
    (Object.const_defined?(sym) && Object.const_get(sym))
end

.toUTF8(str, encoding = nil) ⇒ Object



2561
2562
2563
# File 'lib/tk.rb', line 2561

def Tk.toUTF8(str, encoding = nil)
  _toUTF8(str, encoding)
end

.ungrid(*args) ⇒ Object



2437
2438
2439
# File 'lib/tk.rb', line 2437

def Tk.ungrid(*args)
  TkGrid.forget(*args)
end

.unload_tcllibrary(*args) ⇒ Object



2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
# File 'lib/tk.rb', line 2300

def Tk.unload_tcllibrary(*args)
  if args[-1].kind_of?(Hash)
    keys = _symbolkey2str(args.pop)
    nocomp = (keys['nocomplain'])? '-nocomplain': None
    keeplib = (keys['keeplibrary'])? '-keeplibrary': None
    tk_call('unload', nocomp, keeplib, '--', *args)
  else
    tk_call('unload', *args)
  end
end

.unpack(*args) ⇒ Object



2427
2428
2429
# File 'lib/tk.rb', line 2427

def Tk.unpack(*args)
  TkPack.forget(*args)
end

.unplace(*args) ⇒ Object



2447
2448
2449
# File 'lib/tk.rb', line 2447

def Tk.unplace(*args)
  TkPlace.forget(*args)
end

.update(idle = nil) ⇒ Object



2451
2452
2453
2454
2455
2456
2457
# File 'lib/tk.rb', line 2451

def Tk.update(idle=nil)
  if idle
    tk_call_without_enc('update', 'idletasks')
  else
    tk_call_without_enc('update')
  end
end

.update_idletasksObject



2458
2459
2460
# File 'lib/tk.rb', line 2458

def Tk.update_idletasks
  update(true)
end

.UTF8_String(str) ⇒ Object



117
# File 'lib/tk/autoload.rb', line 117

def Tk.UTF8_String(str); Tk::UTF8_String.new(str); end

.utf_to_backslash(str) ⇒ Object



2583
2584
2585
# File 'lib/tk.rb', line 2583

def Tk.utf_to_backslash(str)
  Tk::EncodedString.utf_to_backslash_sequence(str)
end

.utf_to_backslash_sequence(str) ⇒ Object



2580
2581
2582
# File 'lib/tk.rb', line 2580

def Tk.utf_to_backslash_sequence(str)
  Tk::EncodedString.utf_to_backslash_sequence(str)
end

.wakeup(id) ⇒ Object



2414
2415
2416
2417
# File 'lib/tk.rb', line 2414

def Tk.wakeup(id)
  ((id.kind_of?(TkVariable))? id: TkVarAccess.new(id.to_s)).value = 0
  nil
end

.widget_set_symbolsObject



357
358
359
# File 'lib/tk/autoload.rb', line 357

def widget_set_symbols
  @TOPLEVEL_ALIAS_TABLE.keys
end

Instance Method Details

#encodingObject



39
40
41
# File 'sample/demos-en/tkencoding.rb', line 39

def encoding
  INTERP.encoding
end

#encoding=(name) ⇒ Object



35
36
37
# File 'sample/demos-en/tkencoding.rb', line 35

def encoding=(name)
  INTERP.encoding = name
end

#Grid(*args) ⇒ Object



8
# File 'lib/tk/autoload.rb', line 8

def Grid(*args); TkGrid.configure(*args); end

#Pack(*args) ⇒ Object



11
# File 'lib/tk/autoload.rb', line 11

def Pack(*args); TkPack.configure(*args); end

#Place(*args) ⇒ Object



14
# File 'lib/tk/autoload.rb', line 14

def Place(*args); TkPlace.configure(*args); end

#rootObject



2283
2284
2285
# File 'lib/tk.rb', line 2283

def root
  Tk::Root.new
end

#update(idle = nil) ⇒ Object



2461
2462
2463
2464
2465
# File 'lib/tk.rb', line 2461

def update(idle=nil)
  # only for backward compatibility (This never be recommended to use)
  Tk.update(idle)
  self
end