Here’s how you can draw a chess board in Gtk.jl (from the docs) :
using Gtk, Graphics
c = @GtkCanvas()
win = GtkWindow(c, "Canvas")
function rect!(ctx,x,y,w,h,col)
rectangle(ctx, x, y, w, h)
set_source_rgb(ctx, col...)
fill(ctx)
end
@guarded draw(c) do widget
ctx = getgc(c)
h,w = height(c), width(c)
N=8
for (i,x) in enumerate(linspace(0,w,N)), (j,y) in enumerate(linspace(0,h,N))
rect!(ctx,x,y,w/N,h/N, mod(i+j,2)==0 ? (0.1,0.1,0.1) : (1.0,1.0,1.0) )
end
end
show(c)
There’s also an example of handling mouse clicks in the docs.