But this was cool!
create a window with xpce and swi-prolog that has text “hello world” and ok-button
:- use_module(library(pce)).
% Create a new window
window(Window) :-
new(Window, window('Hello World')),
send(Window, size, size(400, 200)).
% Add a "Hello World" label to the window
label(Window) :-
new(Label, label(text, 'Hello World')),
send(Window, display, Label, point(100, 50)).
% Add an "OK" button to the window
button(Window) :-
new(Button, button(ok)),
send(Window, display, Button, point(150, 100)),
send(Button, message, message(Window, destroy)).
% Open the window and start the event loop
main :-
window(Window),
label(Window),
button(Window),
send(Window, open).