Skip to content

Instantly share code, notes, and snippets.

@windwiny
Created April 17, 2013 02:58
Show Gist options
  • Save windwiny/5401448 to your computer and use it in GitHub Desktop.
Save windwiny/5401448 to your computer and use it in GitHub Desktop.
Ruby get Tk Class
require 'tk'
File.open '/tmp/tk1.txt', 'w' do |f|
Object.constants.grep( /^Tk/).sort.each do |x|
n = Object.const_get x rescue x
f.puts "#{x} \t#{n.to_s} \t#{n.__id__}"
end
end
File.open '/tmp/ttk1.txt', 'w' do |f|
Ttk.constants.sort.each do |x|
n = Ttk.const_get x rescue x
f.puts "#{x} \t#{n.to_s} \t#{n.__id__}"
end
end
File.open '/tmp/tktile1.txt', 'w' do |f|
Tk::Tile.constants.sort.each do |x|
n = Tk::Tile.const_get x rescue x
f.puts "#{x} \t#{n.to_s} \t#{n.__id__}"
end
end
File.open '/tmp/tki1.txt', 'w' do |f|
Tk.constants.sort.each do |x|
n = Tk.const_get(x) rescue x
f.puts "#{x} \t#{n.to_s rescue nil} \t#{n.__id__}"
end
end
__END__
# TkXXX, size == 153
# Ttk::XXX == Tk::Tile::XXX , size == 62
# Tk::XXX, size ~= 65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment