Is it necessary to call Tk() when writing a GUI app with Tkinter?

Mel Wilson mwilson at the-wire.com
Fri Mar 2 21:52:24 CET 2012


Terry Reedy wrote:

> The problem was another subtle bug in the current example":
>          self.hi_there["text"] = "Hello",
> 
> The spurious comma at the end makes the value of the 'text' attribute a
> one-elememt tuple and not just a string. I presume tcl-based tk handles
> that in the manner appropriate for the tcl equivalent. I believe tcl
> uses spaces rather than commas to separate items, so the braces serve as
> 'quotes' to indicate that the contents are one item, not three. Removing
> the comma solves the problem.

That looks like it.  Tcl is the 'LISP of strings'  Composite-object things 
like indexing work on space-separated strings.


	Mel.



More information about the Python-list mailing list