class Object

Constants

Arc
Bitmap
BitmapImage
Button
Canvas
Checkbutton
Entry
Font

autoload

Frame
Grid
Label
Line
Listbox
Message
Oval
Pack
PhotoImage

A photo is an image whose pixels can display any color or be transparent. At present, only GIF and PPM/PGM formats are supported, but an interface exists to allow additional image file formats to be added easily.

This class documentation is a copy from the original Tcl/Tk at www.tcl.tk/man/tcl8.5/TkCmd/photo.htm with some rewritten parts.

Place
Polygon
Radiobutton
Rectangle
Scale
Scrollbar
Selection
Spinbox
Text
TextItem
TkAfter
TkDialog2
TkMsgCat

class TkMsgCatalog

TkNamedVirtualEvent
TkOption
TkResourceDB
TkRoot
TkSystemMenu
TkWarning2

dialog for warning

TkcNamedTag
TktImage
TktMark
TktMarkAnchor
TktMarkCurrent
TktMarkInsert
TktNamedMark
TktNamedTag
TktTag
TktTagSel
TktWindow
TopLevel
Ttk
Variable
VirtualEvent
WindowItem
Winfo

#<RDoc::Comment:0x09f4b4ac>


#<RDoc::Comment:0x09f492ec>

Public Instance Methods

Mainloop() click to toggle source
# File lib/tkclass.rb, line 45
def Mainloop
  Tk.mainloop
end
TkGrid(*args) click to toggle source
# File lib/tk/autoload.rb, line 18
def TkGrid(*args); TkGrid.configure(*args); end
TkPack(*args) click to toggle source
# File lib/tk/autoload.rb, line 21
def TkPack(*args); TkPack.configure(*args); end
TkPlace(*args) click to toggle source
# File lib/tk/autoload.rb, line 24
def TkPlace(*args); TkPlace.configure(*args); end
__method_missing_alias_for_MultiTkIp__(id, *args)
Alias for: method_missing
check_pkg(file, verbose=false) click to toggle source
# File lib/tkextlib/pkg_checker.rb, line 91
def check_pkg(file, verbose=false)
  pkg_list = get_pkg_list(file)

  error_list = []
  success_list = {}

  pkg_list.each{|name, type|
    next if success_list[name]

    begin
      case type
      when :package
        ver = TkPackage.require(name)
        success_list[name] = ver
        error_list.delete_if{|n, t| n == name}

      when :library
        Tk.load_tcllibrary(name)
        success_list[name] = :library
        error_list.delete_if{|n, t| n == name}

      when :script
        Tk.load_tclscript(name)
        success_list[name] = :script
        error_list.delete_if{|n, t| n == name}

      when :require_ruby_lib
        require name

      end
    rescue => e
      if verbose
        error_list << [name, type, e.message]
      else
        error_list << [name, type]
      end
    end
  }

  success_list.dup.each{|name, ver|
    unless ver.kind_of?(String)
      begin
        ver = TkPackage.require(name)
        success_list[name] = ver
      rescue
      end
    end
  }

  [success_list, error_list]
end
get_pkg_list(file) click to toggle source
# File lib/tkextlib/pkg_checker.rb, line 66
def get_pkg_list(file)
  pkg_list = []

  File.foreach(file){|l|
    if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)TkPackage\s*\.\s*require\s*\(?\s*(["'])((\w|:)+)\1/
      pkg = [$2, :package]
      pkg_list << pkg unless pkg_list.member?(pkg)
    end
    if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)Tk\s*\.\s*load_tcllibrary\s*\(?\s*(["'])((\w|:)+)\1/
      pkg = [$2, :library]
      pkg_list << pkg unless pkg_list.member?(pkg)
    end
    if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)Tk\s*\.\s*load_tclscript\s*\(?\s*(["'])((\w|:)+)\1/
      pkg = [$2, :script]
      pkg_list << pkg unless pkg_list.member?(pkg)
    end
    if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)require\s*\(?\s*(["'])((\w|\/|:)+)\1/
      pkg = [$2, :require_ruby_lib]
      pkg_list << pkg unless pkg_list.member?(pkg)
    end
  }

  pkg_list
end
help_msg() click to toggle source
# File lib/tkextlib/pkg_checker.rb, line 16
def help_msg
  print "Usage: #{$0} [-l] [-v] [-h] [--] [dir]\n"
  print "\tIf dir is omitted, check the directory that this command exists.\n"
  print "\tAvailable options are \n"
  print "\t  -l : Add dir to $LOAD_PATH\n"
  print "\t       (If dir == '<parent>/tkextlib', add <parent> also.)\n"
  print "\t  -v : Verbose mode (show reason of fail)\n"
  print "\t  -h : Show this message\n"
  print "\t  -- : End of options\n"
end
method_missing(id, *args) click to toggle source
# File lib/multi-tk.rb, line 2067
def method_missing(id, *args)
  begin
    has_top = (top = MultiTkIp.__getip.__pseudo_toplevel) &&
      top.respond_to?(:pseudo_toplevel_evaluable?) &&
      top.pseudo_toplevel_evaluable? &&
      top.respond_to?(id)
  rescue Exception => e
    has_top = false
  end

  if has_top
    top.__send__(id, *args)
  else
    __method_missing_alias_for_MultiTkIp__(id, *args)
  end
end
subdir_check(dir, verbose=false) click to toggle source
# File lib/tkextlib/pkg_checker.rb, line 143
def subdir_check(dir, verbose=false)
  Dir.foreach(dir){|f|
    next if f == '.' || f == '..'
    if File.directory?(f)
      subdir_check(File.join(dir, f))
    elsif File.extname(f) == '.rb'
      path = File.join(dir, f)
      suc, err = check_pkg(path, verbose)
      if err.empty?
        print 'Ready : ', path, ' : require->', suc.inspect, "\n"
      else
        print '*LACK : ', path, ' : require->', suc.inspect,
          '  FAIL->', err.inspect, "\n"
      end
    end
  }
end