Gtk stopped working on MacOS in March or April 2024

Gtk stopped working for me on MacOS sometime this semester (I am teaching a music signal processing course using Julia with >60 students). Here is a MWE of code that worked a month or so ago and now does not work on MacOS 13.6.6 or 14.4.1 (it is likely that I’ve done security updates for both versions during the term):

using Gtk

win = GtkWindow("My First Gtk.jl Program", 400, 200)

b = GtkButton("Click Me")
push!(win,b)

function on_button_clicked(w)
  println("The button has been clicked")
end
signal_connect(on_button_clicked, b, "clicked")

signal_connect(win, "key-press-event") do widget, event
	println("You pressed key ", event.keyval)
end

showall(win)

I am using Julia 1.10.2 and Gtk v1.3.0 in both cases.

The error message is: (<unknown>:18639): Gtk-WARNING **: 21:31:19.255: drawing failure for widget 'GtkButton': the surface type is not appropriate for the operation

I reported the issue Gtk not working on MacOS Sonoma 14.4 or 14.4.1 · Issue #698 · JuliaGraphics/Gtk.jl · GitHub but I wanted to see if anyone in the broader Julia community is able to get Gtk to work on any version of MacOS. This has been a big headache for my students (and me).

Gtk.jl is no longer maintained. On the other hand, Gkt4.jl is alive and well, and routinely tested on MacOS. There is a section in the manual which should help in porting your code.

2 Likes

Oh my, I sure wish I knew that before the semester began!
I’ll make PR at the repo.