Python not a Very High-Level Language?
Denys Duchier
Denys.Duchier at ps.uni-sb.de
Wed Jan 12 16:06:58 EST 2000
I apologize for the delay in responding to your question, but our
newsfeed was out to lunch for about a week.
Frank Sergeant <frank.sergeant at redneck.net> writes:
> I think I saw that you have an interface to Tk. Could you discuss
> GUI building in Mozart a little?
Drat! Just the thing I know least about; how did you guess? I am
forwarding this message to Christian Schulte who was responsible for
the development of our Tk interface and who is and has been
supervising a number of students in the general area of GUI
programming in Oz. According to my agenda, we have a meeting
scheduled tomorrow where the current state of the GTK interface will
be presented. I am eager to learn about that :-)
The Tk interface follows a fairly simple design: the Oz process starts
a Tk subprocess and communicates with it via a socket. On the Oz
side, Tk widgets are represented by Oz objects. The Oz/Tk interface
is actually a very thin OO flavored layer.
To be concrete, here is the functor (a bit like a Python module) for
an application that takes a message argument (using a --msg option)
and displays it in a label together with a quit button:
functor
import Tk Application
define
Args = {Application.getArgs
record(msg(single type:string optional:false))}
proc {Exit} {Application.exit 0} end
Top = {New Tk.toplevel tkInit}
Msg = {New Tk.label tkInit(parent:Top text:Args.msg)}
But = {New Tk.button tkInit(parent:Top text:'Quit' action:Exit)}
{Tk.send pack(Msg But)}
end
Here Top, Msg and But are Oz objects that correspond to the obvious Tk
widgets.
A tutorial for Tk/GUI programming in Oz is available at:
http://www.mozart-oz.org/documentation/wp/index.html
If you have a question about some more specific aspect of GUI
programming (or anything else for that matter) in Oz, Christian and I
would be delighted to elaborate.
Cheers,
--
Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de
Forschungsbereich Programmiersysteme (Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50 Phone: +49 681 302 5618
66041 Saarbruecken, Germany Fax: +49 681 302 5615
More information about the Python-list
mailing list