GtkInteract

276 views
Skip to first unread message

j verzani

unread,
Sep 6, 2014, 4:35:33 PM9/6/14
to julia...@googlegroups.com
The new Interact.jl package allows you to use interactive widgets such as sliders, dropdowns and checkboxes to play with your Julia code within an IJulia session. It is pretty neat, in particular the `@manipulate` macro. For those times where IJulia is not convenient, but the console is, I've made a small wrapper package GtkInteract.jl that creates these widgets in Gtk with the expectation that Winston will be used for graphics. If you are interested in such a thing, you can try it out by cloning the package: Pkg.clone("https://github.com/jverzani/GtkInteract.jl.git"). 

Iain Dunning

unread,
Sep 7, 2014, 2:11:25 AM9/7/14
to julia...@googlegroups.com
Don't think I need this personally, but just wanted to say - looks cool!

Shashi Gowda

unread,
Sep 7, 2014, 2:45:23 AM9/7/14
to julia...@googlegroups.com
This is very cool!

I really love how there is no lag in the example and things seem so responsive. Added a link in the Interact.jl README.

One of Interact's goals is to make such adaptions hassle-free. Please do file issues if you think some change to Interact can make your code neater.

Shashi Gowda

unread,
Sep 7, 2014, 2:56:02 AM9/7/14
to julia...@googlegroups.com
It would be nice if the same code that begins with `using Interact` can run in multiple environments. But this arrangement is cool too. Right now, all IJulia specific stuff is in Interact/src/IJulia. It was initially a separate package, then we put it inside Interact for convenience. The main thing the IJulia specific part does is override writemime(::IO, ::MIME, ::Signal) and  writemime(::IO, ::MIME, ::Widget) to set up communication and invoke IPython widgets.

This highly dated document https://github.com/JuliaLang/Interact.jl/blob/master/DESIGN.md describes some of the initial ideas about separating environment specifics from widget models.

Kaj Wiik

unread,
Sep 7, 2014, 4:38:19 AM9/7/14
to julia...@googlegroups.com
Very useful, many thanks!!

Cheers!

Tim Holy

unread,
Sep 7, 2014, 8:05:09 AM9/7/14
to julia...@googlegroups.com
John, this sounds very interesting. At some point I will need to do a bit of
an overhaul on ImageView, and I certainly plan to take a close look at this
package.

Best,
--Tim

Shashi Gowda

unread,
Sep 7, 2014, 8:21:15 AM9/7/14
to julia...@googlegroups.com
Tim, is there a way to show Compose output in ImageView? Will be nice to have SVG rendering - that's the fastest Compose backend. It would also let Gadfly plots show up.

Andreas Lobinger

unread,
Sep 7, 2014, 9:36:19 AM9/7/14
to julia...@googlegroups.com
Hello colleagues,


On Sunday, September 7, 2014 2:21:15 PM UTC+2, Shashi Gowda wrote:
Tim, is there a way to show Compose output in ImageView? Will be nice to have SVG rendering - that's the fastest Compose backend. It would also let Gadfly plots show up.

Compose (as most of the drawing is done via Cairo Surfaces anyway) has the option to draw/render into an available Cairo Surface.
With that and a few lines of Gtk definitions you can paint Gadfly on screen.


julia> using Gtk

julia> using Gadfly

julia> using Compose

julia> p = plot(x=rand(40,1),y=rand(40,1));

julia> co = render(p);

julia> c = Gtk.@GtkCanvas(400,300);

julia> w = Gtk.@GtkWindow(c,"data win");

julia> show(c);

julia> Gtk.draw(c) do widget
       Compose.draw(CAIROSURFACE(c.back),co)
       end

gives me a plot into a resizable Gtk Window.

The replotting is not super-fast, so it's not suited to animations.

j verzani

unread,
Sep 7, 2014, 8:46:38 PM9/7/14
to julia...@googlegroups.com
It would be nice. I sorted out the Gtk code from the Interact code. But I would need to remove the output widgets to have any luck with having the same @manipulate commands working in both environments. I couldn't figure out how to generate these automatically.

j verzani

unread,
Sep 7, 2014, 8:47:52 PM9/7/14
to julia...@googlegroups.com
Tim it is useful for really simple things, but ImageView would be too complicated.
Reply all
Reply to author
Forward
0 new messages