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:
ext/lib/tk/autoload.rb,
ext/lib/tk/wm.rb,
ext/lib/tk/clock.rb,
ext/lib/tk/macpkg.rb,
ext/lib/tk/autoload.rb,
ext/lib/tk/autoload.rb,
ext/lib/tk/autoload.rb,
ext/lib/tk/variable.rb,
ext/lib/tkextlib/vu.rb,
ext/lib/tk/optionobj.rb,
ext/lib/tkextlib/blt.rb,
ext/lib/tk/encodedstr.rb,
ext/lib/tk/scrollable.rb,
ext/lib/tk/validation.rb,
ext/lib/tkextlib/tile.rb,
ext/lib/tkextlib/tile.rb,
ext/lib/tkextlib/tile.rb,
ext/lib/tkextlib/tile.rb,
ext/lib/tkextlib/tile.rb,
ext/lib/tkextlib/tile.rb,
ext/lib/tkextlib/tkDND.rb,
ext/lib/tkextlib/tkimg.rb,
ext/lib/tk/ttk_selector.rb,
ext/lib/tkextlib/tcllib.rb,
ext/lib/tkextlib/vu/pie.rb,
ext/lib/tkextlib/bwidget.rb,
ext/lib/tkextlib/version.rb,
ext/lib/tkextlib/vu/dial.rb,
ext/lib/tkextlib/iwidgets.rb,
ext/lib/tkextlib/tkimg/ps.rb,
ext/lib/tkextlib/tclx/tclx.rb,
ext/lib/tkextlib/tkimg/bmp.rb,
ext/lib/tkextlib/tkimg/gif.rb,
ext/lib/tkextlib/tkimg/ico.rb,
ext/lib/tkextlib/tkimg/pcx.rb,
ext/lib/tkextlib/tkimg/png.rb,
ext/lib/tkextlib/tkimg/ppm.rb,
ext/lib/tkextlib/tkimg/sgi.rb,
ext/lib/tkextlib/tkimg/sun.rb,
ext/lib/tkextlib/tkimg/tga.rb,
ext/lib/tkextlib/tkimg/xbm.rb,
ext/lib/tkextlib/tkimg/xpm.rb,
ext/lib/tkextlib/vu/charts.rb,
ext/lib/tkextlib/tcllib/ico.rb,
ext/lib/tkextlib/tile/style.rb,
ext/lib/tkextlib/tkimg/jpeg.rb,
ext/lib/tkextlib/tkimg/tiff.rb,
ext/lib/tkextlib/vu/spinbox.rb,
ext/lib/tkextlib/ICONS/icons.rb,
ext/lib/tkextlib/itk/incr_tk.rb,
ext/lib/tkextlib/tile/dialog.rb,
ext/lib/tkextlib/tile/tentry.rb,
ext/lib/tkextlib/tile/tframe.rb,
ext/lib/tkextlib/tile/tlabel.rb,
ext/lib/tkextlib/tile/tpaned.rb,
ext/lib/tkextlib/tile/tscale.rb,
ext/lib/tkextlib/tkDND/shape.rb,
ext/lib/tkextlib/tkDND/tkdnd.rb,
ext/lib/tkextlib/trofs/trofs.rb,
ext/lib/tkextlib/vu/bargraph.rb,
ext/lib/tkextlib/bwidget/tree.rb,
ext/lib/tkextlib/tcllib/ctext.rb,
ext/lib/tkextlib/tile/tbutton.rb,
ext/lib/tkextlib/tile/tsquare.rb,
ext/lib/tkextlib/tkimg/pixmap.rb,
ext/lib/tkextlib/tkimg/window.rb,
ext/lib/tkextlib/bwidget/entry.rb,
ext/lib/tkextlib/bwidget/label.rb,
ext/lib/tkextlib/itcl/incr_tcl.rb,
ext/lib/tkextlib/tcllib/cursor.rb,
ext/lib/tkextlib/tcllib/cursor.rb,
ext/lib/tkextlib/tile/sizegrip.rb,
ext/lib/tkextlib/tile/treeview.rb,
ext/lib/tkextlib/winico/winico.rb,
ext/lib/tkextlib/bwidget/bitmap.rb,
ext/lib/tkextlib/bwidget/button.rb,
ext/lib/tkextlib/bwidget/dialog.rb,
ext/lib/tkextlib/bwidget/widget.rb,
ext/lib/tkextlib/iwidgets/shell.rb,
ext/lib/tkextlib/iwidgets/watch.rb,
ext/lib/tkextlib/tile/tcombobox.rb,
ext/lib/tkextlib/tile/tnotebook.rb,
ext/lib/tkextlib/bwidget/listbox.rb,
ext/lib/tkextlib/bwidget/spinbox.rb,
ext/lib/tkextlib/iwidgets/dialog.rb,
ext/lib/tkextlib/iwidgets/tabset.rb,
ext/lib/tkextlib/tcllib/ip_entry.rb,
ext/lib/tkextlib/tile/tscrollbar.rb,
ext/lib/tkextlib/tile/tseparator.rb,
ext/lib/tkextlib/tktable/tktable.rb,
ext/lib/tkextlib/tktrans/tktrans.rb,
ext/lib/tkextlib/bwidget/combobox.rb,
ext/lib/tkextlib/bwidget/dragsite.rb,
ext/lib/tkextlib/bwidget/dropsite.rb,
ext/lib/tkextlib/bwidget/notebook.rb,
ext/lib/tkextlib/iwidgets/menubar.rb,
ext/lib/tkextlib/iwidgets/spinint.rb,
ext/lib/tkextlib/iwidgets/spinner.rb,
ext/lib/tkextlib/iwidgets/toolbar.rb,
ext/lib/tkextlib/tcllib/datefield.rb,
ext/lib/tkextlib/tcllib/plotchart.rb,
ext/lib/tkextlib/tile/tlabelframe.rb,
ext/lib/tkextlib/tile/tmenubutton.rb,
ext/lib/tkextlib/bwidget/buttonbox.rb,
ext/lib/tkextlib/bwidget/mainframe.rb,
ext/lib/tkextlib/bwidget/passwddlg.rb,
ext/lib/tkextlib/bwidget/separator.rb,
ext/lib/tkextlib/bwidget/statusbar.rb,
ext/lib/tkextlib/iwidgets/calendar.rb,
ext/lib/tkextlib/iwidgets/checkbox.rb,
ext/lib/tkextlib/iwidgets/combobox.rb,
ext/lib/tkextlib/iwidgets/feedback.rb,
ext/lib/tkextlib/iwidgets/notebook.rb,
ext/lib/tkextlib/iwidgets/radiobox.rb,
ext/lib/tkextlib/iwidgets/spindate.rb,
ext/lib/tkextlib/iwidgets/spintime.rb,
ext/lib/tkextlib/tcllib/autoscroll.rb,
ext/lib/tkextlib/tcllib/autoscroll.rb,
ext/lib/tkextlib/tcllib/autoscroll.rb,
ext/lib/tkextlib/tcllib/tkpiechart.rb,
ext/lib/tkextlib/tile/tcheckbutton.rb,
ext/lib/tkextlib/tile/tprogressbar.rb,
ext/lib/tkextlib/tile/tradiobutton.rb,
ext/lib/tkextlib/tkHTML/htmlwidget.rb,
ext/lib/tkextlib/bwidget/labelentry.rb,
ext/lib/tkextlib/bwidget/labelframe.rb,
ext/lib/tkextlib/bwidget/messagedlg.rb,
ext/lib/tkextlib/bwidget/panelframe.rb,
ext/lib/tkextlib/bwidget/scrollview.rb,
ext/lib/tkextlib/bwidget/selectfont.rb,
ext/lib/tkextlib/bwidget/titleframe.rb,
ext/lib/tkextlib/iwidgets/buttonbox.rb,
ext/lib/tkextlib/iwidgets/dateentry.rb,
ext/lib/tkextlib/iwidgets/datefield.rb,
ext/lib/tkextlib/iwidgets/extbutton.rb,
ext/lib/tkextlib/iwidgets/hierarchy.rb,
ext/lib/tkextlib/iwidgets/hyperhelp.rb,
ext/lib/tkextlib/iwidgets/timeentry.rb,
ext/lib/tkextlib/iwidgets/timefield.rb,
ext/lib/tkextlib/bwidget/arrowbutton.rb,
ext/lib/tkextlib/bwidget/dynamichelp.rb,
ext/lib/tkextlib/bwidget/panedwindow.rb,
ext/lib/tkextlib/bwidget/progressbar.rb,
ext/lib/tkextlib/bwidget/progressdlg.rb,
ext/lib/tkextlib/bwidget/selectcolor.rb,
ext/lib/tkextlib/iwidgets/entryfield.rb,
ext/lib/tkextlib/iwidgets/finddialog.rb,
ext/lib/tkextlib/iwidgets/mainwindow.rb,
ext/lib/tkextlib/iwidgets/messagebox.rb,
ext/lib/tkextlib/iwidgets/optionmenu.rb,
ext/lib/tkextlib/iwidgets/pushbutton.rb,
ext/lib/tkextlib/treectrl/tktreectrl.rb,
ext/lib/tkextlib/bwidget/pagesmanager.rb,
ext/lib/tkextlib/iwidgets/dialogshell.rb,
ext/lib/tkextlib/iwidgets/panedwindow.rb,
ext/lib/tkextlib/iwidgets/tabnotebook.rb,
ext/lib/tkextlib/iwidgets/labeledframe.rb,
ext/lib/tkextlib/iwidgets/promptdialog.rb,
ext/lib/tkextlib/iwidgets/scopedobject.rb,
ext/lib/tkextlib/iwidgets/scrolledhtml.rb,
ext/lib/tkextlib/iwidgets/scrolledtext.rb,
ext/lib/tkextlib/iwidgets/selectionbox.rb,
ext/lib/tkextlib/tcllib/tablelist_core.rb,
ext/lib/tkextlib/tcllib/tablelist_tile.rb,
ext/lib/tkextlib/bwidget/scrolledwindow.rb,
ext/lib/tkextlib/iwidgets/labeledwidget.rb,
ext/lib/tkextlib/iwidgets/messagedialog.rb,
ext/lib/tkextlib/iwidgets/scrolledframe.rb,
ext/lib/tkextlib/bwidget/scrollableframe.rb,
ext/lib/tkextlib/iwidgets/canvasprintbox.rb,
ext/lib/tkextlib/iwidgets/scrolledcanvas.rb,
ext/lib/tkextlib/iwidgets/scrolledwidget.rb,
ext/lib/tkextlib/iwidgets/disjointlistbox.rb,
ext/lib/tkextlib/iwidgets/scrolledlistbox.rb,
ext/lib/tkextlib/iwidgets/selectiondialog.rb,
ext/lib/tkextlib/iwidgets/fileselectionbox.rb,
ext/lib/tkextlib/iwidgets/canvasprintdialog.rb,
ext/lib/tkextlib/iwidgets/extfileselectionbox.rb,
ext/lib/tkextlib/iwidgets/fileselectiondialog.rb,
ext/lib/tkextlib/iwidgets/extfileselectiondialog.rb,
ext/lib/tk.rb,
ext/lib/tk.rb,
ext/lib/tk.rb,
ext/lib/tk.rb,
ext/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, Clock, Encoding, Img, Itcl, ItemValidateConfigure, Itk, Iwidgets, MacResource, Scrollable, SystemMenu, 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

CloneMenu =
Tk::MenuClone
Tk::Menubutton
OptionMenuButton =
Tk::OptionMenubutton
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')
Labelframe =
Tk::LabelFrame
X_Scrollable =
XScrollable
Y_Scrollable =
YScrollable
Checkbutton =
Tk::CheckButton
Panedwindow =
Tk::PanedWindow
Radiobutton =
Tk::RadioButton
Tkextlib_RELEASE_DATE =
'2008-11-25'.freeze
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 =
'2009-01-13'.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, 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=, 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_str, number, procedure, simplelist, 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, callback, eval_cmd, #hash_kv, hash_kv, install_cmd, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd

Methods included from TkEvent

#install_bind, #install_bind_for_event_class

Class Method Details

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



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

def __set_toplevel_aliases__(target, obj, *symbols)
  @TOPLEVEL_ALIAS_TABLE[target = target.to_sym] ||= {}
  symbols.each{|sym|
    @TOPLEVEL_ALIAS_TABLE[target][sym = sym.to_sym] = obj
    # if @current_default_widget_set == target
    if @TOPLEVEL_ALIAS_OWNER[sym] == target
      Object.class_eval{remove_const sym} if Object.const_defined?(sym)
      Object.const_set(sym, obj)
    end
  }
end

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



2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
# File 'ext/lib/tk.rb', line 2358

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

.bell(nice = false) ⇒ Object



2186
2187
2188
2189
2190
2191
2192
2193
# File 'ext/lib/tk.rb', line 2186

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



2195
2196
2197
2198
2199
2200
2201
2202
# File 'ext/lib/tk.rb', line 2195

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



110
# File 'ext/lib/tk/autoload.rb', line 110

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

.const_missing(sym) ⇒ Object



2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
# File 'ext/lib/tk.rb', line 2009

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



2310
2311
2312
2313
2314
2315
2316
# File 'ext/lib/tk.rb', line 2310

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 'ext/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



331
332
333
# File 'ext/lib/tk/autoload.rb', line 331

def default_widget_set
  @current_default_widget_set
end

.default_widget_set=(target) ⇒ Object



335
336
337
338
339
340
341
342
343
344
# File 'ext/lib/tk/autoload.rb', line 335

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

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



2370
2371
2372
2373
2374
2375
2376
2377
2378
# File 'ext/lib/tk.rb', line 2370

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



2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
# File 'ext/lib/tk.rb', line 2204

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



107
# File 'ext/lib/tk/autoload.rb', line 107

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

.errorCodeObject



2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
# File 'ext/lib/tk.rb', line 2084

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



2079
2080
2081
2082
# File 'ext/lib/tk.rb', line 2079

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

.exitObject



2215
2216
2217
# File 'ext/lib/tk.rb', line 2215

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

.focus(display = nil) ⇒ Object



2318
2319
2320
2321
2322
2323
2324
# File 'ext/lib/tk.rb', line 2318

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



2334
2335
2336
# File 'ext/lib/tk.rb', line 2334

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

.focus_next(win) ⇒ Object



2338
2339
2340
# File 'ext/lib/tk.rb', line 2338

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

.focus_prev(win) ⇒ Object



2342
2343
2344
# File 'ext/lib/tk.rb', line 2342

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

.focus_to(win, force = false) ⇒ Object



2326
2327
2328
2329
2330
2331
2332
# File 'ext/lib/tk.rb', line 2326

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



2384
2385
2386
# File 'ext/lib/tk.rb', line 2384

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

.grid(*args) ⇒ Object



2250
2251
2252
# File 'ext/lib/tk.rb', line 2250

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

.grid_forget(*args) ⇒ Object



2253
2254
2255
# File 'ext/lib/tk.rb', line 2253

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

.has_mainwindow?Boolean

Returns:

  • (Boolean)


2098
2099
2100
# File 'ext/lib/tk.rb', line 2098

def Tk.has_mainwindow?
  INTERP.has_mainwindow?
end

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



2115
2116
2117
# File 'ext/lib/tk.rb', line 2115

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

.load_tclscript(file, enc = nil) ⇒ Object



2106
2107
2108
2109
2110
2111
2112
2113
# File 'ext/lib/tk.rb', line 2106

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 'ext/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 'ext/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



2301
2302
2303
2304
# File 'ext/lib/tk.rb', line 2301

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

.pack(*args) ⇒ Object



2240
2241
2242
# File 'ext/lib/tk.rb', line 2240

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

.pack_forget(*args) ⇒ Object



2243
2244
2245
# File 'ext/lib/tk.rb', line 2243

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

.pkgconfig_get(mod, key) ⇒ Object



2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
# File 'ext/lib/tk.rb', line 2149

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



2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
# File 'ext/lib/tk.rb', line 2130

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



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

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

.place_forget(*args) ⇒ Object



2263
2264
2265
# File 'ext/lib/tk.rb', line 2263

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

.raise_window(win, above = None) ⇒ Object



2305
2306
2307
2308
# File 'ext/lib/tk.rb', line 2305

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

.show_kinsoku(mode = 'both') ⇒ Object



2350
2351
2352
2353
2354
2355
2356
2357
# File 'ext/lib/tk.rb', line 2350

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



2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
# File 'ext/lib/tk.rb', line 2221

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



2346
2347
2348
# File 'ext/lib/tk.rb', line 2346

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

.subst_tk_backslash(str) ⇒ Object



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

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

.subst_utf_backslash(str) ⇒ Object



2393
2394
2395
# File 'ext/lib/tk.rb', line 2393

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

.tcl_pkgconfig_get(key) ⇒ Object



2171
2172
2173
2174
# File 'ext/lib/tk.rb', line 2171

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

.tcl_pkgconfig_listObject



2166
2167
2168
2169
# File 'ext/lib/tk.rb', line 2166

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.



2290
2291
2292
2293
2294
2295
2296
# File 'ext/lib/tk.rb', line 2290

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



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

def Tk.thread_update_idletasks
  thread_update(true)
end

.tk_pkgconfig_get(key) ⇒ Object



2181
2182
2183
2184
# File 'ext/lib/tk.rb', line 2181

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

.tk_pkgconfig_listObject



2176
2177
2178
2179
# File 'ext/lib/tk.rb', line 2176

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

.to_backslash_sequence(str) ⇒ Object



2405
2406
2407
# File 'ext/lib/tk.rb', line 2405

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

.toUTF8(str, encoding = nil) ⇒ Object



2380
2381
2382
# File 'ext/lib/tk.rb', line 2380

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

.ungrid(*args) ⇒ Object



2256
2257
2258
# File 'ext/lib/tk.rb', line 2256

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

.unload_tcllibrary(*args) ⇒ Object



2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
# File 'ext/lib/tk.rb', line 2119

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



2246
2247
2248
# File 'ext/lib/tk.rb', line 2246

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

.unplace(*args) ⇒ Object



2266
2267
2268
# File 'ext/lib/tk.rb', line 2266

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

.update(idle = nil) ⇒ Object



2270
2271
2272
2273
2274
2275
2276
# File 'ext/lib/tk.rb', line 2270

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

.update_idletasksObject



2277
2278
2279
# File 'ext/lib/tk.rb', line 2277

def Tk.update_idletasks
  update(true)
end

.UTF8_String(str) ⇒ Object



113
# File 'ext/lib/tk/autoload.rb', line 113

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

.utf_to_backslash(str) ⇒ Object



2402
2403
2404
# File 'ext/lib/tk.rb', line 2402

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

.utf_to_backslash_sequence(str) ⇒ Object



2399
2400
2401
# File 'ext/lib/tk.rb', line 2399

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

.wakeup(id) ⇒ Object



2233
2234
2235
2236
# File 'ext/lib/tk.rb', line 2233

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

Instance Method Details

#Grid(*args) ⇒ Object



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

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

#Pack(*args) ⇒ Object



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

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

#Place(*args) ⇒ Object



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

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

#rootObject



2102
2103
2104
# File 'ext/lib/tk.rb', line 2102

def root
  Tk::Root.new
end

#update(idle = nil) ⇒ Object



2280
2281
2282
2283
2284
# File 'ext/lib/tk.rb', line 2280

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