I am not familiar with GNU Smalltalk (I use Pharo), so maybe there is better way to write the code, but regardless.
Installation
gst
installed from package manager doesn't need any GUI (it's a CLI), and even though it offers them, it doesn't pull the necessary system libraries to run them, so you have to install them manually:
- for
gst-browser
(new ui): libgtk2.0
libcairo2
(tested on ubuntu)
- for
gst-blox
(old ui): tcl
tk
(not tested)
Code
I see two problems with the code: GST doesn't support Process>>sleep:
, and it uses GUI.
As for GUI, Smalltalks have very different UI libraries, Dolphin is geared towards MS Windows, GNU Smalltalk uses GNU stuff (GTK for the newser gst-browser, and TK/TCL for older gst-blox it seems), Pharo uses Athens, etc. Even if they share some concepts (such as MVC pattern), they do not really share API.
In fact it seems that GNUSmalltalk has "new" UI --- VisualGST (gst-browser) and that gst-blox is deprecated.
In any case, after some digging I end up with the following code. It creates a GTK window (UI used by gst-browser), and then it continuously updates the text.
window := GTK.GtkWindow new: GTK.Gtk gtkWindowToplevel.
window setTitle: 'Time'.
window resize: 400 height: 300.
label := GTK.GtkLabel new.
label setText: Time now printString.
label show.
window add: label.
window show.
digitalClockProcess := [[
(Delay forSeconds: 1) wait.
label setText: Time now printString.
] repeat] fork.
The code for gst-blox
would have to use tcl/tk instead, which I am not familiar with.
Running the code
To run the code in gst-browser
, from top menu select 'Tools > Bottom Pane', and then paste the code to a 'Workspace' that will be in the bottom pane (you can add more workspaces via 'File > New Workspace'.