[Tkinter-discuss] text doesn't look the same in IDLE/console and in Text widget

Michael Lange klappnase at web.de
Fri May 14 07:47:10 EDT 2004


On Fri, 14 May 2004 13:44:09 +1000
EuGèNe Van den Bulke <eugene at boardkulture.com> wrote:

> 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
> 

Hi Eugene,

could you tell what exactly your problem is, I tried your example and the output looked
quite the same to me both on the shell and the text widget:

micron (   rpi) future
    15 (   178)      3
    15 (     7)     13

Do you get any other result in your text widget and how does it look like?

Regards

Michael




More information about the Tkinter-discuss mailing list