Which GUI?

Gerrit Holl gerrit.holl at pobox.com
Tue Feb 22 22:13:15 CET 2000


<quote name="Fredrik Lundh" date="951177245">
...
> second, even if Tk hadn't been object-oriented, what makes
> you think that providing an object-oriented layer on top of
> a non-object-oriented library would be a bad thing?

In general, I don't think it is a bad thing, but for Tkinter, I'll explain.

For GUI's built on top of C++ libs, like wxPython or PyQT, it's not
needed to provide full documentation for Python. It's very easy to
translate C++ docs to Python calls, with a little help. For Tkinter,
however, much more trouble is needed to use Tcl docs to write Tkinter.

At a moment, I needed some reference to creating things in canvas in
Tkinter. I found this in the Tcl manpage:

       pathName create type x y ?x y ...? ?option value ...?
              Create a new item in pathName of  type  type.   The
              exact format of the arguments after type depends on
              type, but usually they consist of  the  coordinates
              for  one or more points, followed by specifications
              for zero or more item options.  See the subsections
              on individual item types below for more on the syn-
              tax of this command.  This command returns  the  id
              for the new item.

It took me a LOT of time to find out how to implement this in Python. It
turned out to be some set of methods to Canvas, a different method for
every `type'! I had to look it up in the source! I can't understand
why this has been done, by the way.

If a C++ reference could be used, however, it'd be almost equivalent.
So it's not needed to create a full wxPython reference. There is a
doc about the few minor differences between wxWindows and wxPython.
This applies to all GUI's. Except Tkinter.

> are you aware of the fact that major portions of the standard library
> are designed that way?

Yes.

> do you really think that anyone would
> take you seriously if you claimed that Python's file objects, or
> the socket module shouldn't be used?  (after all, the underlying
> C library isn't "object oriented"...)

No, no, no, you understand be wrong! GUI's are IMHO a special case.

regards,
Gerrit.

-- 
Comparison Python GUI's: http://www.nl.linux.org/~gerrit/gui.html
Please comment!




More information about the Python-list mailing list