That's probably at least part of why Tk is horrible and needs to die a long overdue death. Whereas Gtk can simply share a memory buffer with the user with very little overhead. (full disclosure: I wrote and maintain the Gtk.jl wrapper, with the express purpose of making Tk go away)
julia> using Gtk.ShortNames julia> win = @Window("Test", 800, 600); julia> data = Gtk.RGB[Gtk.RGB(div(255*x,800),div(255*y,600),0) for x=0:800, y=0:600]; julia> pixbuf = @Pixbuf(data=data,has_alpha=false) # removing the has_alpha parameter required variable is https://github.com/JuliaLang/Gtk.jl/issues/94 julia> view = @Image(pixbuf); julia> push!(win,view); julia> showall(win); julia> data[:] = Gtk.RGB(0,0,0); julia> G_.from_pixbuf(view, pixbuf) # this function calls gtk_image_set_from_pixbuf, which is necessary to tell our GtkImage canvas that it needs to redraw now julia> @time for i = 1:255 data[:] = Gtk.RGB(0,0,i) G_.from_pixbuf(view, pixbuf) sleep(0.01) end elapsed time: 3.799350398 seconds (113220 bytes allocated) julia> 0.01*255 2.5500000000000003 On Sun, Jul 6, 2014 at 11:02 PM, De Prins Maxime <de.prins.max...@gmail.com> wrote: > Hi, > > *I can do this:* > > > using Base.Graphics > > using Cairo > > using Tk > > > > using Base.Graphics > > using Cairo > > using Tk > > > win = Toplevel("Test", 800, 600) > > c = Canvas(win) > > pack(c, expand=true, fill="both") > > ctx = getgc(c) > > for x = 0:800 > > for y = 0:600 > > set_coords(ctx, x, y, 1, 1, 0, 1, 0, 1) > > set_source_rgb(ctx, x/800, y/600, 0) > > paint(ctx) > > end > > end > > reveal(c) > > Tk.update() > > But it is slow and not very nice. > > Thanks > >