JuliaGtk / GtkUtilities.jl

Interactive utilities for the Gtk toolkit (Julia)
Other
5 stars 8 forks source link

Does Grid() not work with GtkUtilities, or is the issue elsewhere? #21

Closed tomerarnon closed 7 years ago

tomerarnon commented 7 years ago

I am using Gtk.Shortnames and GtkUtilties in my gui, and this very simple example code doesn't work:

using  Gtk.ShortNames, Images, TestImages, GtkUtilities

A = testimage("lighthouse")

win = Window("image")
c = Canvas()
g = Grid(visible = true)
g[1,1] = c
push!(win, g)

@guarded draw(c) do widget
    copy!(widget, A)
end

showall(win)

This returns a blank window. If instead I remove mention of the grid and simply copy! to the canvas, then this returns what I expect (but doesn't allow me to populate a grid with various items). Is the problem with placing the image in the grid in the first place? Is there a way to do this successfully while still being able to use GtkUtilities's canvas-specific functions?

timholy commented 7 years ago

You might need setproperty!(c, :expand, true)? I'm more than a little vague on when that is and isn't necessary, but when I can't see something it's often the first thing I try. I may have discovered it by reading source code, or perhaps by trial and error.

timholy commented 7 years ago

Also, in case it's of interest, GtkReactive is official now: https://discourse.julialang.org/t/ann-building-guis-with-gtkreactive-plus-profileview-changes/2828

tomerarnon commented 7 years ago

I never came back to respond to this, it seems. This did indeed solve the problem, and thank you for the referral to GtkReactive (though I am not yet using it)