Skip to content

Is it currently possible to draw and updating plots from any backend?  #19

@Boxylmer

Description

@Boxylmer

I'm trying to build a GTK application in glade, I know it's possible to push!(widget, container) and can access object made in Glade with dict-like accessors i.e.,

gladefile = GtkBuilder(filename=joinpath(@__DIR__, "testfile.glade"))
win = gladefile["main_window"]
button1 = gladefile["button1"]

But once I'm here, how can I use GtkObservables.jl to link a Plots.jl (or any other backend) plot to a GtkCanvas or similar widget, and insert it into my GUI? I'm starting with something simple here:

using Gtk, Plots, GtkObservables

gladefile = GtkBuilder(filename=joinpath(@__DIR__, "testfile.glade"))
win = gladefile["main_window"]
button1 = gladefile["button1"]
plot_frame = gladefile["plot_frame"]
canv = GtkCanvas()

showall(win)

function button_clicked_callback(widget)
    println(get_gtk_property(widget, :name, String), " was clicked!")
    h = Gtk.height(plot_frame)
    w = Gtk.width(plot_frame)
    x = randn(1000)
    y = randn(1000)
    # myplot = scatter(x, y)
    # push!(plot_frame, myplot)  # unsafe_convert doesn't know how to deal with this
end
signal_connect(button_clicked_callback, button1, "clicked")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions