Hi,
after a long break, I’ve restarted playing with SWI-prolog and its graphical object-oriented extension XPCE lately and I would like to know: is there a way of adding information to the general clause
send(Obj, open)
in such a way that the Obj window doesn’t open randomly (or following the default values), but rather in a precise part of the screen? Because if I don’t set specific parameters I always get the window opened in the wrong place (overlapping other windows for example).
Thanks for your answer and thank you all for the development of SWI-Prolog during all these years.
Marco
Thank you PasiK! So the trick is to create two objects (a frame/window and a point) and then add that the window should open at that point with the specification (position := ObjRef) to the send(Obj, open) clause. Apropos XPCE: I also had the impression that it is no longer developed/maintained, but I don’t know why I was interested in it. Thanks a lot!
Actually the idea that I’d like to work on is to use xpce and its drawing capabilities to build a little system that draws syntactic labelled parse trees out of prolog compound terms/lists representing parsed sentences with their syntactic structure (S, NP, VP, Det… and so on…) and then with the lexical items. But I don’t know: a) is it possible (in principle it doesn’t seem impossible at least), b) will I be patient enough to carry out the task? I’ll let you know if I make any progress
A common way of doing this is to use GraphViz by generating a description of the graph in DOT. And there are other tools such as https://www.tomsawyer.com/ .
At the moment I’m trying with the dot language which peter ludemann suggested because the syntax is very simple and it doesn’t seem impossible to build a pipeline in three steps: prolog file > .gv file > .svg file. At least that’s what I have in mind. I’ll let you know. Swish is really a great thing. I agree
Well, I’m quite happy to say that it worked! I’m a happy man
The grammar is really primitive: it only tackles simple sentences with a subject, a verb and an optional adverbial modifier like [a, boy, eats, slowly] or [the, cat, silently, sleeps] and so on. The basic ideas are contained in Bramer’s Logic programming with Prolog and Learn Prolog Now! by Blackburn, Bos and Striegnitz.
A predicate takes as input a sentence (represented as a list of words) and outputs a parsed structure like
Not sure if you tried to upload the *.gv and *.svg files here to show others but you should be able.
If not let me know, I have admin rights on this site.
For an example of such uploaded files see this reply.