Task

Create a window and draw a pixel in it, subject to the following:

  the window is 320 x 240
  the color of the pixel must be red (255,0,0)
  the position of the pixel is x = 100, y = 100
using Gtk, Graphics
 
const can = @GtkCanvas()
const win = GtkWindow(can, "Draw a Pixel", 320, 240)
 
draw(can) do widget
    ctx = getgc(can)
    set_source_rgb(ctx, 255, 0, 0)
    move_to(ctx, 100, 100)
    line_to(ctx, 101,100)
    stroke(ctx)
end
 
show(can)
const cond = Condition()
endit(w) = notify(cond)
signal_connect(endit, win, :destroy)
wait(cond)
 