Hi! I want to make transparent window with several graphic layers and information.
I found ‘opacity’ property, but it work with window and child canvas.
So, I found partial solution:
c = @GtkCanvas()
win = GtkWindow(c, "Canvas")
ccall((:gtk_window_set_keep_above, Gtk.libgtk), Nothing, (Ptr{GObject},), win)
ccall((:gtk_widget_set_app_paintable, Gtk.libgtk), Nothing, (Ptr{GObject}, Bool), win, true)
show(c)
@guarded draw(c) do widget
ctx = getgc(c)
h = height(c)
w = width(c)
rectangle(ctx,10, 100, w/2, h/2)
set_source_rgb(ctx, 0, 1, 0)
fill(ctx)
end
@guarded draw(c) do widget
ctx = getgc(c)
h = height(c)
w = width(c)
rectangle(ctx, 0, 0, w/4, h/4)
set_source_rgb(ctx, 1,0,0)
fill(ctx)
rectangle(ctx,10, 100, w/2, h/2)
set_source_rgb(ctx, 0, 1, 0)
fill(ctx)
end
signal_connect(win,"key_press_event") do widget, event
if event.keyval == 32
@guarded draw(c) do widget2
ctx = getgc(c)
fill(ctx)
end
end
show(c)
println(event.keyval)
end
But It clear only if windows resized. What is a good way to make some moving objects in canvas?