[Python-Dev] Tkinter problems with Tcl/Tk 8.5
"Martin v. Löwis"
martin at v.loewis.de
Sun Dec 16 12:13:02 CET 2007
> It also has been suggested by some on the Tcl core team (during
> discussions about this bug) that you probably shouldn't be using
> Tcl_GetObjType and relying on the registered Tcl_ObjTypes, however I'm
> not sure of a way to get what you need otherwise.
Hi George,
I hope I can find some time next week to look into this in more detail,
but please let me respond to this first.
In Python, objects have a fixed type, given to them at the point of
creation. Also, it is common in Python to use multiple types, not
just a single one (say, string). So to convert between Tcl objects
and Python objects, we would like to preserve type information as
much as possible.
To do that, _tkinter has two functions: AsObj (converting PyObject
to Tcl_Obj), and FromObj (converting Tcl_Obj to PyObj). We map
the well-known (registered) types 1:1 to appropriate Python types,
and have a default for the rest.
If Tcl_GetObjType was not available, I see no other way but to
convert everything through strings, which would put the burden
of typing things onto the Tkinter user (or perhaps on Tkinter,
to type the well-known commands).
Regards,
Martin
More information about the Python-Dev
mailing list