# Gtk / Gtk4: transperent window (overlay) with layers

**URL:** <https://discourse.julialang.org/t/gtk-gtk4-transperent-window-overlay-with-layers/128080>\
**Category:** Visualization\
**Created:** [April 15, 2025, 1:07am UTC](https://discourse.julialang.org/t/gtk-gtk4-transperent-window-overlay-with-layers/128080 "2025-04-15T01:07:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PharmCat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pharmcat/32/6953_2.png) [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Post date:** [April 15, 2025, 1:07am UTC](https://discourse.julialang.org/t/gtk-gtk4-transperent-window-overlay-with-layers/128080/1 "2025-04-15T01:07:58Z")

</div>

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:

```julia
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?
