freeze core modules
TclTkLib.freeze TclTkIp.freeze TkUtil.freeze TkKernel.freeze TkComm.freeze TkComm::Event.freeze TkCore.freeze Tk.freeze
Methods
BinaryString
EncodedString
UTF8_String
add_kinsoku
bell
bell_on_display
const_missing
current_grabs
cursor_display
delete_kinsoku
destroy
errorCode
errorInfo
exit
focus
focus_lastfor
focus_next
focus_prev
focus_to
fromUTF8
grid
grid_forget
has_mainwindow?
load_tcllibrary
load_tclscript
load_tclscript_rsrc
load_tclscript_rsrcid
lower_window
pack
pack_forget
pkgconfig_get
pkgconfig_list
place
place_forget
raise_window
root
show_kinsoku
strictMotif
subst_tk_backslash
subst_utf_backslash
tcl_pkgconfig_get
tcl_pkgconfig_list
thread_update
thread_update_idletasks
tk_pkgconfig_get
tk_pkgconfig_list
toUTF8
to_backslash_sequence
ungrid
unload_tcllibrary
unpack
unplace
update
update
update_idletasks
utf_to_backslash
utf_to_backslash_sequence
Included Modules
Classes and Modules
Module Tk::BLTModule Tk::BWidget
Module Tk::Clock
Module Tk::Encoding
Module Tk::Img
Module Tk::Itcl
Module Tk::ItemValidateConfigure
Module Tk::Itk
Module Tk::Iwidgets
Module Tk::Scrollable
Module Tk::TclX
Module Tk::Tcllib
Module Tk::Tile
Module Tk::TkDND
Module Tk::TkTrans
Module Tk::Trofs
Module Tk::ValidateConfigure
Module Tk::Vu
Module Tk::Wm
Module Tk::X_Scrollable
Module Tk::Y_Scrollable
Class Tk::BinaryString
Class Tk::EncodedString
Class Tk::HTML_Widget
Class Tk::ICONS
Class Tk::OptionObj
Class Tk::TkTable
Class Tk::TreeCtrl
Class Tk::UTF8_String
Class Tk::Winico
Constants
| AUTO_PATH | = | TkVarAccess.new('auto_path', auto_path) |
| TCL_PACKAGE_PATH | = | 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') |
| 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 | = | '2005-12-07'.freeze |
Public Class methods
# File tk/autoload.rb, line 189
189: def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
# File tk.rb, line 2132
2132: def Tk.add_kinsoku(chars, mode='both')
2133: begin
2134: if /^8\.*/ === TK_VERSION && JAPANIZED_TK
2135: tk_split_simplelist(tk_call('kinsoku', 'add', mode,
2136: *(chars.split(''))))
2137: else
2138: []
2139: end
2140: rescue
2141: []
2142: end
2143: end
# File tk.rb, line 1981
1981: def Tk.bell(nice = false)
1982: if nice
1983: tk_call_without_enc('bell', '-nice')
1984: else
1985: tk_call_without_enc('bell')
1986: end
1987: nil
1988: end
# File tk.rb, line 1990
1990: def Tk.bell_on_display(win, nice = false)
1991: if nice
1992: tk_call_without_enc('bell', '-displayof', win, '-nice')
1993: else
1994: tk_call_without_enc('bell', '-displayof', win)
1995: end
1996: nil
1997: end
# File tk.rb, line 1804
1804: def Tk.const_missing(sym)
1805: case(sym)
1806: when :TCL_LIBRARY
1807: INTERP._invoke_without_enc('global', 'tcl_library')
1808: INTERP._invoke("set", "tcl_library").freeze
1809:
1810: when :TK_LIBRARY
1811: INTERP._invoke_without_enc('global', 'tk_library')
1812: INTERP._invoke("set", "tk_library").freeze
1813:
1814: when :LIBRARY
1815: INTERP._invoke("info", "library").freeze
1816:
1817: #when :PKG_PATH, :PACKAGE_PATH, :TCL_PACKAGE_PATH
1818: # INTERP._invoke_without_enc('global', 'tcl_pkgPath')
1819: # tk_split_simplelist(INTERP._invoke('set', 'tcl_pkgPath'))
1820:
1821: #when :LIB_PATH, :LIBRARY_PATH, :TCL_LIBRARY_PATH
1822: # INTERP._invoke_without_enc('global', 'tcl_libPath')
1823: # tk_split_simplelist(INTERP._invoke('set', 'tcl_libPath'))
1824:
1825: when :PLATFORM, :TCL_PLATFORM
1826: if $SAFE >= 4
1827: fail SecurityError, "can't get #{sym} when $SAFE >= 4"
1828: end
1829: INTERP._invoke_without_enc('global', 'tcl_platform')
1830: Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get',
1831: 'tcl_platform'))]
1832:
1833: when :ENV
1834: INTERP._invoke_without_enc('global', 'env')
1835: Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'env'))]
1836:
1837: #when :AUTO_PATH #<===
1838: # tk_split_simplelist(INTERP._invoke('set', 'auto_path'))
1839:
1840: #when :AUTO_OLDPATH
1841: # tk_split_simplelist(INTERP._invoke('set', 'auto_oldpath'))
1842:
1843: when :AUTO_INDEX
1844: INTERP._invoke_without_enc('global', 'auto_index')
1845: Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'auto_index'))]
1846:
1847: when :PRIV, :PRIVATE, :TK_PRIV
1848: priv = {}
1849: if INTERP._invoke_without_enc('info', 'vars', 'tk::Priv') != ""
1850: var_nam = 'tk::Priv'
1851: else
1852: var_nam = 'tkPriv'
1853: end
1854: INTERP._invoke_without_enc('global', var_nam)
1855: Hash[*tk_split_simplelist(INTERP._invoke('array', 'get',
1856: var_nam))].each{|k,v|
1857: k.freeze
1858: case v
1859: when /^-?\d+$/
1860: priv[k] = v.to_i
1861: when /^-?\d+\.?\d*(e[-+]?\d+)?$/
1862: priv[k] = v.to_f
1863: else
1864: priv[k] = v.freeze
1865: end
1866: }
1867: priv
1868:
1869: else
1870: raise NameError, 'uninitialized constant Tk::' + sym.id2name
1871: end
1872: end
# File tk.rb, line 2084
2084: def Tk.current_grabs(win = nil)
2085: if win
2086: window(tk_call_without_enc('grab', 'current', win))
2087: else
2088: tk_split_list(tk_call_without_enc('grab', 'current'))
2089: end
2090: end
# File tkextlib/tcllib/cursor.rb, line 46
46: def self.cursor_display(parent=None)
47: # Pops up a dialog with a listbox containing all the cursor names.
48: # Selecting a cursor name will display it in that dialog.
49: # This is simply for viewing any available cursors on the platform .
50: #tk_call_without_enc('::cursor::display', parent)
51: Tk::Tcllib::Cursor.cursor_display(parent)
52: end
# File tk.rb, line 2144
2144: def Tk.delete_kinsoku(chars, mode='both')
2145: begin
2146: if /^8\.*/ === TK_VERSION && JAPANIZED_TK
2147: tk_split_simplelist(tk_call('kinsoku', 'delete', mode,
2148: *(chars.split(''))))
2149: end
2150: rescue
2151: end
2152: end
# File tk.rb, line 1999
1999: def Tk.destroy(*wins)
2000: #tk_call_without_enc('destroy', *wins)
2001: tk_call_without_enc('destroy', *(wins.collect{|win|
2002: if win.kind_of?(TkWindow)
2003: win.epath
2004: else
2005: win
2006: end
2007: }))
2008: end
# File tk.rb, line 1879
1879: def Tk.errorCode
1880: INTERP._invoke_without_enc('global', 'errorCode')
1881: code = tk_split_simplelist(INTERP._invoke_without_enc('set', 'errorCode'))
1882: case code[0]
1883: when 'CHILDKILLED', 'CHILDSTATUS', 'CHILDSUSP'
1884: begin
1885: pid = Integer(code[1])
1886: code[1] = pid
1887: rescue
1888: end
1889: end
1890: code
1891: end
# File tk.rb, line 1874
1874: def Tk.errorInfo
1875: INTERP._invoke_without_enc('global', 'errorInfo')
1876: INTERP._invoke_without_enc('set', 'errorInfo')
1877: end
# File tk.rb, line 2092
2092: def Tk.focus(display=nil)
2093: if display == nil
2094: window(tk_call_without_enc('focus'))
2095: else
2096: window(tk_call_without_enc('focus', '-displayof', display))
2097: end
2098: end
# File tk.rb, line 2108
2108: def Tk.focus_lastfor(win)
2109: window(tk_call_without_enc('focus', '-lastfor', win))
2110: end
# File tk.rb, line 2100
2100: def Tk.focus_to(win, force=false)
2101: if force
2102: tk_call_without_enc('focus', '-force', win)
2103: else
2104: tk_call_without_enc('focus', win)
2105: end
2106: end
# File tk.rb, line 2158
2158: def Tk.fromUTF8(str, encoding = nil)
2159: _fromUTF8(str, encoding)
2160: end
# File tk.rb, line 1910
1910: def Tk.load_tcllibrary(file, pkg_name=None, interp=None)
1911: tk_call('load', file, pkg_name, interp)
1912: end
# File tk.rb, line 1901
1901: def Tk.load_tclscript(file, enc=nil)
1902: if enc
1903: # TCL_VERSION >= 8.5
1904: tk_call('source', '-encoding', enc, file)
1905: else
1906: tk_call('source', file)
1907: end
1908: end
# File tk/macpkg.rb, line 12
12: def Tk.load_tclscript_rsrc(resource_name, file=None)
13: # Mac only
14: tk_call('source', '-rsrc', resource_name, file)
15: end
# File tk/macpkg.rb, line 17
17: def Tk.load_tclscript_rsrcid(resource_id, file=None)
18: # Mac only
19: tk_call('source', '-rsrcid', resource_id, file)
20: end
# File tk.rb, line 2075
2075: def Tk.lower_window(win, below=None)
2076: tk_call('lower', _epath(win), _epath(below))
2077: nil
2078: end
# File tk.rb, line 1944
1944: def Tk.pkgconfig_get(mod, key)
1945: # Tk8.5 feature
1946: if mod.kind_of?(Module)
1947: if mod.respond_to?(:package_name)
1948: pkgname = mod.package_name
1949: else
1950: fail NotImplementedError, 'may not be a module for a Tcl extension'
1951: end
1952: else
1953: pkgname = mod.to_s
1954: end
1955:
1956: pkgname = '::' << pkgname unless pkgname =~ /^::/
1957:
1958: tk_call(pkgname + '::pkgconfig', 'get', key)
1959: end
# File tk.rb, line 1925
1925: def Tk.pkgconfig_list(mod)
1926: # Tk8.5 feature
1927: if mod.kind_of?(Module)
1928: if mod.respond_to?(:package_name)
1929: pkgname = mod.package_name
1930: elsif mod.const_defined?(:PACKAGE_NAME)
1931: pkgname = mod::PACKAGE_NAME
1932: else
1933: fail NotImplementedError, 'may not be a module for a Tcl extension'
1934: end
1935: else
1936: pkgname = mod.to_s
1937: end
1938:
1939: pkgname = '::' << pkgname unless pkgname =~ /^::/
1940:
1941: tk_split_list(tk_call(pkgname + '::pkgconfig', 'list'))
1942: end
# File tk.rb, line 2079
2079: def Tk.raise_window(win, above=None)
2080: tk_call('raise', _epath(win), _epath(above))
2081: nil
2082: end
# File tk.rb, line 2124
2124: def Tk.show_kinsoku(mode='both')
2125: begin
2126: if /^8\.*/ === TK_VERSION && JAPANIZED_TK
2127: tk_split_simplelist(tk_call('kinsoku', 'show', mode))
2128: end
2129: rescue
2130: end
2131: end
# File tk.rb, line 2120
2120: def Tk.strictMotif(mode=None)
2121: bool(tk_call_without_enc('set', 'tk_strictMotif', mode))
2122: end
# File tk.rb, line 2170
2170: def Tk.subst_tk_backslash(str)
2171: Tk::EncodedString.subst_tk_backslash(str)
2172: end
# File tk.rb, line 2167
2167: def Tk.subst_utf_backslash(str)
2168: Tk::EncodedString.subst_utf_backslash(str)
2169: end
# File tk.rb, line 1966
1966: def Tk.tcl_pkgconfig_get(key)
1967: # Tk8.5 feature
1968: Tk.pkgconfig_get('::tcl', key)
1969: end
# File tk.rb, line 1961
1961: def Tk.tcl_pkgconfig_list
1962: # Tk8.5 feature
1963: Tk.pkgconfig_list('::tcl')
1964: end
| 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. |
# File tk.rb, line 2064
2064: def Tk.thread_update(idle=nil)
2065: if idle
2066: tk_call_without_enc('thread_update', 'idletasks')
2067: else
2068: tk_call_without_enc('thread_update')
2069: end
2070: end
# File tk.rb, line 1976
1976: def Tk.tk_pkgconfig_get(key)
1977: # Tk8.5 feature
1978: Tk.pkgconfig_get('::tk', key)
1979: end
# File tk.rb, line 1971
1971: def Tk.tk_pkgconfig_list
1972: # Tk8.5 feature
1973: Tk.pkgconfig_list('::tk')
1974: end
# File tk.rb, line 2154
2154: def Tk.toUTF8(str, encoding = nil)
2155: _toUTF8(str, encoding)
2156: end
# File tk.rb, line 2179
2179: def Tk.to_backslash_sequence(str)
2180: Tk::EncodedString.to_backslash_sequence(str)
2181: end
# File tk.rb, line 1914
1914: def Tk.unload_tcllibrary(*args)
1915: if args[-1].kind_of?(Hash)
1916: keys = _symbolkey2str(args.pop)
1917: nocomp = (keys['nocomplain'])? '-nocomplain': None
1918: keeplib = (keys['keeplibrary'])? '-keeplibrary': None
1919: tk_call('unload', nocomp, keeplib, '--', *args)
1920: else
1921: tk_call('unload', *args)
1922: end
1923: end
# File tk.rb, line 2044
2044: def Tk.update(idle=nil)
2045: if idle
2046: tk_call_without_enc('update', 'idletasks')
2047: else
2048: tk_call_without_enc('update')
2049: end
2050: end
# File tk.rb, line 2176
2176: def Tk.utf_to_backslash(str)
2177: Tk::EncodedString.utf_to_backslash_sequence(str)
2178: end
# File tk.rb, line 2173
2173: def Tk.utf_to_backslash_sequence(str)
2174: Tk::EncodedString.utf_to_backslash_sequence(str)
2175: end