From fbb73b1e588a8c87102ef9f9f50ee3b1f706b55c Mon Sep 17 00:00:00 2001 From: ExpandingMan Date: Fri, 23 Sep 2022 14:10:38 -0400 Subject: [PATCH] fix the drawing tutorial (#35) Co-authored-by: Tim Holy --- Project.toml | 2 +- docs/src/drawing.md | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index ca6e61a..b7880b5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "GtkObservables" uuid = "8710efd8-4ad6-11eb-33ea-2d5ceb25a41c" -version = "1.2.4" +version = "1.2.5" [deps] Cairo = "159f3aea-2a34-519c-b102-8c37f9878175" diff --git a/docs/src/drawing.md b/docs/src/drawing.md index b2a6261..abf012c 100644 --- a/docs/src/drawing.md +++ b/docs/src/drawing.md @@ -8,7 +8,9 @@ lines. Let's begin by creating a window with a canvas in it: ```julia -using Gtk.ShortNames, GtkObservables, Graphics, Colors +using GtkObservables, Colors +using GtkObservables.Gtk +using GtkObservables.Gtk.ShortNames win = Window("Drawing") c = canvas(UserUnit) # create a canvas with user-specified coordinates @@ -83,7 +85,7 @@ sigextend = on(c.mouse.motion) do btn # extend `newline` with the most recent point push!(newline[], btn.position) # notify any observers -- alternatively we could reassign to newline[] - Observables.notify(newline) + notify(newline) end end ``` @@ -104,7 +106,7 @@ sigend = on(c.mouse.buttonrelease) do btn # We do this in a way that prevents triggering anything (yet). newline.val = [] # Now trigger - Observables.notify(lines) + notify(lines) end end ``` @@ -125,7 +127,7 @@ function): redraw = draw(c, lines, newline) do cnvs, lns, newl # the function body takes 3 arguments fill!(cnvs, colorant"white") # set the background to white set_coordinates(cnvs, BoundingBox(0, 1, 0, 1)) # set coordinates to 0..1 along each axis - ctx = getgc(cnvs) # gets the "graphics context" object (see Cairo/Gtk) + ctx = Gtk.getgc(cnvs) # gets the "graphics context" object (see Cairo/Gtk) for l in lns drawline(ctx, l, colorant"blue") # draw old lines in blue end