The Spec Gtk bindings for Pharo
You need Gtk4 (installed by brew because paths are fixed for now)
brew install gtk+4
WARNING: You cannot run gtk applications using a PharoVM downloaded with zeroconf.
The reason is zeroconf downloads some libraries required to run the vm and those libraries
conflicts with the system libraries.
Instead, please go to the OBS (Open Build Service) Pharo Package built and install the VM for your distribution.
You need to have Gtk4 installed (this should be already the case). You can verify with this command:
apt list --installed | grep gtk4
or
dnf list --installed | grep gtk4
You will need to remove some library files shipped with the Pharo VM:
rm ~/pharo/vm/lib/libfreetype.so* ~/pharo/vm/lib/libcairo*.so*
Windows version is currently not working (an FFI problem we are working to solve,
hopefully in the next weeks.
Sorry for the (momentary) inconvenience.
- Download a Pharo 14.0 image:
curl get.pharo.org/140 | bash
- Open your image using
./pharo --worker Pharo.image --interactiveand evaluate:
Metacello new
repository: 'github://pharo-spec/Spec-Gtk:main';
baseline: 'SpecGtk';
onConflict: [ :e | e useIncoming ];
onUpgrade: [ :e | e useIncoming ];
ignoreImage;
loadAfter the execution, save the image, and quit.
Running GTK now requires the Pharo VM to be run in worker mode: ./pharo --worker Pharo.image.
In macOS, running the World in Morphic is not yet possible since the SDL loop will execute in the worker and assume Cocoa is in the same thread. It cannot work since Cocoa must run in the main thread.
The following code should open a small UI:
SpLabelPresenter new
application: (SpApplication new useBackend: #Gtk);
label: 'Hello, Gtk4';
open.Currently, only the low-level infrastructure is supported. Tools building based on solely Spec2/Gtk are under way. Be patient.