interactive programme (add a new line in Tk)

James Stroud jstroud at
Mon Mar 27 02:05:41 CEST 2006

nigel wrote:
> somebody recently  showed me how to create a new line using \n which was 
> great.The thing is when i am creating the programme the text i wish to add is 
> quite long.and it ends up stretching the width of several pages,which i think 
> looks quite messy.Would it be possible for some one to show me how to create 
> another line while writing my programme.What i mean by this is where my text 
> ends "iv arrived"i wish to add a new line beneath to continue my text so i do 
> not reach the end of the page.
> from Tkinter import *
> root = Tk()
> w = Label(root, text="\n Hello, world! \n iv arrived")
> w.pack()
> root.mainloop()
> Thanks nige

Try the Tkinter.Text widget. You can configure it to be read only, etc. 
so it behaves like a label. It will automatically wrap text for you and 
will put in line breaks ("\n") where you tell it. See


James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

More information about the Python-list mailing list