GTK Problems

Hi! So for classes I have to build a graphic application, and after doing a bit of research I found that Gtk sounded pretty easy to use so I decided to give it a shot. All good so far.

However, I found that the documentation isn’t exactly… great. To give an example, the main problem I’m having is that when I do

using Gtk

win = GtkWindow("My Window", 500, 500)


It just gives me a blank window, and the REPL sends out a bunch of error messages whenever I click on it (note that the code I sent is all I put in, so there isn’t even a button to detect a click; the window is just completely blank without even having an exit button in the corner). The error messages are as follow, but the Gtk Documentation isn’t giving me the slightest hint on what they mean.

(above, error messages in the repl)

So what I mean when I say the documentation is not helpful, is the following ;

I go unto Home · Gtk.jl (which is given in the github repos as the documentation for the project) and follow their instructions, creating the window. And here comes a kicker ;

However, when I click on the “Here” link, this is where it takes me.

The home page. The link to the error doc, takes me to the home page.

The first documentation link just takes me to the GTK download page – which isn’t even for Julia, it’s for c#.

The second documentation takes me to… C# documentation, which doesn’t even give the same functions, and either way gives no clue as to how I would fix any errors – it gives tutorials, sure, but tutorials for a language I’m not using ; nevermind that the tutorial for the language I am using itself gives an error and acknowledges that it’s probably going to give that error. So what gives? They tell me an error can happen but give literally no tools for how to fix it.

So here I am, asking the community if someone has any experience with Gtk.jl and knows how to prevent that issue.

The link points to a section on the page that has been removed because it relates to the old Homebrew based binary distribution system. Unless you’re running a very old version of Julia that shouldn’t be your issue.

While it’s true Gtk.jl is not very well maintained, the error messages you get comes directly from Gtk (the C library) and Gtk.jl (the Julia bindings) just relay them to you. There’s no way Gtk.jl will document the whole library, that’s why the main page just links to Gtk official docs.

I’m not sure what the blank window issue is exactly but I think it’s a setup problem.

I figured as much so I reinstalled Gtk and it still doesn’t feel like working.
When I initially do “win = GtkWindow(“MyWindow”,500,500)” it shows me the empty window and it works okay, can close and everything, but the “showall(win)” just gives an empty window that I can’t close.

Which OS, Julia, Gtk.jl version do you use ?

Windows 10
Julia 1.6.1

Strange, works fine for me with a similar setup. What do you see if you do ]st in ther REPL ? I get :

[4c0ca9eb] Gtk v1.1.7

Issue was fixed : Turns out the REPL was undefining the window if I closed it and reopened it with showall(win). This turned out not to be an issue in a compiled project, because closing the window shut down the project and reopening redefined the window so all is good. It is strange that it did that, but… eh. At least it’s not completely nonfunctional.

1 Like

Regarding the original complaint about the documentation not being complete and in part wrong I am really not sure what we can do. I started the current documentation because the previous was pretty broken but since I do this in my spare time I never got it perfect.

The situation right now is that Gtk is more or less maintainer less but there are about < 5 people who keep the ship sailing without it sinking. This means that Gtk.jl is still pretty functional (I can achieve everything I want from it) but it has several rough edges. Probably we should make a big banner somewhere indicating this fact?

The inactive badge seems appropriate :

  • Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.

1 Like

That is fair. I might have been harsh in my initial post and I apologize for it, I was a little agitated at the time. I think a banner indicating that the project is more in a maintenance optic with a very small team [edit: might be a good idea; GTK was one of the first (and supposedly the easiest to use) packages that I found while researching GUI frameworks, so I think quite a few people might try picking it up, and just adding a banner that says support for the project is slowed down might temper expectations from the package.]

Apologies for my initial post once again.

1 Like

Actually I think your post is absolutely valid because it is clear that one is somewhat disappointed if the project looks fully functional but then you find out that there are some rough edges. I think Gtk.jl is simply a challenging package in a way that people who know the package know how to use it but have no time to make this fully functional. On the other hand I am a strong believer that Gtk is a very good solution for GUI development in Julia. So we are kind of in a dilemma due to the lack of developer time.

Plus essentially every major Julia release has been breaking Gtk.jl is some really bad way (last one : error when static parameter is used in ccall · Issue #41278 · JuliaLang/julia · GitHub) and developing the package requires a deep knowledge of both Gtk and Julia C API, which very few people have.

haha yes, its quite funny actually that Julia 1.x should be a stable release series but it hits Gtk so much. But the reason is simply that it seems to use so much Julia internal API which may change from minor to minor release. So its certainly not really Julia’s fault. One here also has to acknowledge that Gtk.jl was developed during the Julia v0.1 - v0.3 time.

I’ve added a status badge to the readme and updated the doc, thanks @The_Theory for the feedback.

1 Like

If you don’t need a very complex app, GTK Server may be an option for you. It’s quite stable. There’s an intro page and the repo is here. The upstream library is here.