canvar = TkCanvas.new
TkcBitmap.new(canvar, 50, 50,
'bitmap' => '@/usr/local/lib/tk4.2jp/demos/images/letters.bmp')
canvar.pack
canvar.delete(bittag)
#!/usr/local/bin/ruby require "tk" canvas = TkCanvas.new image = TkPhotoImage.new('file' => '/usr/local/lib/tk4.2jp/demos/images/earth.gif') TkcImage.new(canvas, 50, 50, 'image' => image) canvas.pack Tk.mainloop
arc sections of circle
bitmap for X11 bitmap files/builtins
image for Photo image types (gif, xpm, xbm, ...)
line
oval includes circles
polygon may be -filled
rectangle may also be -filled
text similar to Text widget primitive
window allows embeddding of other widgets
#!/usr/local/bin/ruby require "tk" def push_it(line) line.coords 0, 0, 100, 100 end c = TkCanvas.new i = TkcLine.new(c, 0, 0, 50, 50) c.pack TkButton.new { text 'extend' command proc { push_it i} }.pack Tk.mainloop
#!/usr/local/bin/ruby require "tk" min_x = 0 min_y = 0 c = TkCanvas.new i = TkcLine.new(c, 0, 0, 50, 50) c.pack ps = c.postscript('x' => min_x, 'y' => min_y, 'width' => c.cget('width'), 'height' => c.cget('height')) f = open('file.ps', 'w') f.print ps f.close Tk.mainloop
canvas.cget('width')