[Tkinter-discuss] Syntactic problems

Michael Lange klappnase at web.de
Sat Dec 3 19:16:38 CET 2011


Hi Francisco,

Thus spoketh Francisco Gracia <fgragu023 at gmail.com> 
unto us on Sat, 3 Dec 2011 18:48:36 +0100:

> Many thanks to you both, Kevin and Michael for your quick and sensible
> responses. My problems are more in the line suggested by Michael,
> although his hint has not solved them, at least as I have tried to
> implement it.

The problem in you code is not the white space in the font name but the
white space in the tag name (actually this is where the python code
differs from the tcl example, maybe due to a typo).
I changed (the relevant part of) your code into:

for f in sampler :
    # the counter is updated
    count += 1
    # display of the provided font name plus
    # a separator and a tabulator
    tw.insert( END, f + ":\t" )
    # creation of an individual name for the tag
    # that will be applied to the sample for this item

    ftag =  'f' + str( count )# please note the quotes !

    tw.tag_config( ftag, font = ( f, 10 ) )
    # and the sample text:
    tw.insert( END, "This is a simple sampler\n", ftag )

and then it worked as expected.

Best regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

First study the enemy.  Seek weakness.
		-- Romulan Commander, "Balance of Terror", stardate 1709.2


More information about the Tkinter-discuss mailing list