[Tkinter-discuss] Problem with 'cascade' and state=disabled
(maybe)
Henry S. Thompson
ht at inf.ed.ac.uk
Mon Feb 7 22:35:15 CET 2005
Jeff Epler <jepler at unpythonic.net> writes:
> Do you have a full program that demonstrates the problem?
>
> It's *likely* that str(w.entrycget(0, 'menu')) will return the menu's path
> as a string, in all cases.
Nope, that's precisely the bug.
> It's also possible that
> import Tkinter
> Tkinter.wantobjects = 0
> before creating any interpeter will get you a string instead.
Yes, that 'fixed' the problem. But of course it had the side-effect
of causing other uses of entryget to _stop_ returning numbers and go
back to their old behaviour of returning strings.
> Tcl started as a typeless language: everything is a string, but some
> strings can be interpreted as lists, as numbers, or as commands. In
> later versions, Tcl gained an "object" representation, with a C type
> called TclObj* which could hold just a string, an efficient
> representation of numbers or lists, a pointer directly to a command,
> etc.
>
> With 'wantobjects = 1' (the default), a wrapper of a TclObject* can be
> returned from Tkinter calls, rather than a string. In this case, you're
> getting the command object that corresponds to the menu widget, rather
> than the string naming the menu widget, or the Python object that wraps
> that particular menu widget.
So that seems like a bug, and whatever magic (in _tkinter.c ?)
negotiates return types should surely never let a raw cmdObject
surface into Python. . .
I will _try_ to produce a small test case, it may be difficult. . .
ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht at inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
More information about the Tkinter-discuss
mailing list