GtkInteract.jl icon indicating copy to clipboard operation
GtkInteract.jl copied to clipboard

Example in README fails

Open Keno opened this issue 10 years ago • 11 comments

I tried the @manipulate example in the README and got the following error:

ERROR: MethodError: `display` has no method matching display(::Gtk.GtkCanvas, ::Winston.FramedPlot)
Closest candidates are:
  display(::AbstractString, ::Any)
  display(::TextDisplay, ::Any)
  display(::MIME{mime}, ::Any)

Keno avatar Sep 25 '15 05:09 Keno

Thanks, I'll have a look. It seemed to work for me with v0.3 and 0.4RC1, but I think the same issue here is also preventing the use of Plots-generated figures.

jverzani avatar Sep 25 '15 12:09 jverzani

I think 79527f0507ac6afde7e5b5f5c64b1b603e2347ad fixes this and adds support for using Plots with Winston.

jverzani avatar Sep 25 '15 20:09 jverzani

Close, but no cigar: screen shot 2015-09-26 at 4 00 42 pm

Keno avatar Sep 26 '15 20:09 Keno

I can't seem to get this output. I tried both of these and they work more or less as expected (modulo some warnings for using v0.4-RC1):

julia> using GtkInteract, Plots

julia> plotter!(:winston)
Plots.WinstonPackage()

julia> ENV["WINSTON_OUTPUT"] = :gtk;

julia> @manipulate for ϕ = 0:π/16:4π, f = [:sin=>sin, :cos=>cos]
           plot(θ -> f(θ + ϕ), 0, 25)
       end

and the corresponding thing from the README. I really need to set the WINSTON_OUTPUT value before Winston is loaded, as otherwise Tk combined with Gtk causes a crash for me.

jverzani avatar Sep 27 '15 01:09 jverzani

screen shot 2015-09-26 at 9 14 50 pm

Keno avatar Sep 27 '15 01:09 Keno

Does this work? (I'm just dispatching to this display method display(c::Gtk.GtkCanvas, pc::Winston.PlotContainer) at /Users/verzani/.julia/v0.4/Winston/src/gtk.jl:13 , so my guess is no. I might just need to qualify this.)

using Gtk, Plots
ENV["WINSTON_OUTPUT"] = :gtk
plotter!(:winston)

p = plot(sin, 0, 2pi);

cv = @GtkCanvas(480, 480)
w = @GtkWindow()
push!(w, cv)
show(cv)

display(cv, p.o)

jverzani avatar Sep 27 '15 01:09 jverzani

works fine modulo missing text on the plot.

Keno avatar Sep 27 '15 01:09 Keno

Okay, maybe this 28181f6036441ecdb0335784a74054b21533f98f will fix it when used with Plots. Sorry for all the back and forth. Your help is much appreciated.

jverzani avatar Sep 27 '15 01:09 jverzani

Nope, same problem. Also

julia> Gtk.display == display
true

It may be worth noting that I'm on master of all the relevant packages.

Keno avatar Sep 27 '15 03:09 Keno

Okay, after upgrading I now think this is an issue with Requires and the release candidate RC2. I've filed an issue. Thanks.

jverzani avatar Sep 27 '15 13:09 jverzani

In case you still wanted to see if this package can be useful, I temporarily disabled the use of the Requires.jl package and now assume that graphics will be produced using Plots with a backend of Winston and Gtk. The (new) README example should now work on julia v0.4.

jverzani avatar Sep 30 '15 18:09 jverzani