Method: TkPalette.recolorTree

Defined in:
lib/tk/palette.rb

.recolorTree(win, colors) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/tk/palette.rb', line 33

def TkPalette.recolorTree(win, colors)
  if not colors.kind_of?(Hash)
    fail "2nd arg need to be Hash"
  end

  tk_call('global', "tkPalette")
  colors.each{|key, value|
    begin
      if win.cget(key) == tk_call('set', "tkPalette(#{key})")
        win[key] = colors[key]
      end
    rescue
      # ignore
    end
  }

  TkWinfo.children(win).each{|w| TkPalette.recolorTree(w, colors)}
end