You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is either a documentation bug or a code bug I'm not sure.
The doc recommends calling reveal(canvas) to queue a draw call for the canvas' assigned draw function. I see that the code just turns around and calls G_.queue_draw(widget). reveal seems to do nothing though. However, calling draw(canvas) directly seems to do the job. I found this via methods(draw).
Sample code below -
using Gtk4
c =GtkCanvas()
win =GtkWindow("Canvas")
color =Ref(0.0)
@guardeddraw(c) do widget
ctx =getgc(c)
h =height(c)
w =width(c)
# Paint red rectanglerectangle(ctx, 0, 0, w, h/2)
set_source_rgb(ctx, 1, color[], 0)
fill(ctx)
# Paint blue rectanglerectangle(ctx, 0, 3h/4, w, h/4)
set_source_rgb(ctx, 0, 0, 1)
fill(ctx)
end
win.child = c
# Change colour from red to yellow after 5 seconds@asyncbeginsleep(5)
println("FIRE")
color[] =1.0draw(c) # Putting reveal(c) here does not trigger a draw.endshowall(win)
The text was updated successfully, but these errors were encountered:
This is either a documentation bug or a code bug I'm not sure.
The doc recommends calling
reveal(canvas)
to queue a draw call for the canvas' assigned draw function. I see that the code just turns around and callsG_.queue_draw(widget)
.reveal
seems to do nothing though. However, callingdraw(canvas)
directly seems to do the job. I found this viamethods(draw)
.Sample code below -
The text was updated successfully, but these errors were encountered: