[Tkinter-discuss] text doesn't look the same in IDLE/console and in
Text widget
EuGèNe Van den Bulke
eugene at boardkulture.com
Thu May 13 23:44:09 EDT 2004
Hi,
I am pretty new to Python and Tkinter and can't find an answer to an
annoying problem I am encountering with the Text widget. I can line things
up pretty well in the console or IDLE but in a Text widget I can't ... and
don't understand why (I have tried many different fonts but it doens't make
any difference). A small program is better than a long explanation :
-----
from Tkinter import *
root=Tk()
display=Text(root,font=("courrier", 12))
display.pack()
#the type of string I want to display
content="%-6s (%6s) %6s\n" % ('micron','rpi','future')
content+="%6i (%6i) %6i\n" %(15,178,3)
content+="%6i (%6i) %6i\n" %(15,7,13)
#output to the console that looks the way I want it to look
print content
#output to the Text widget that doesn't :(
display.insert(END,content)
root.mainloop()
-----
Thanks for your help,
Eugene
More information about the Tkinter-discuss
mailing list