I also realized now you can do the overwrite directly in the keycode function as long as you use reveal() at the end:
elseif event.keyval == 122
println(" (z was pressed)")
ctx = getgc(c)
set_source_rgb(ctx,1,1,1)
rectangle(ctx,0,0,600,600)
fill(ctx)
reveal(c)
end