interactive programme (add a new line in Tk)

N

nigel

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
 
J

James Stroud

nigel said:
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

http://www.pythonware.com/library/tkinter/introduction/text.htm

James

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

http://www.jamesstroud.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top