By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

interactive programme (add a new line in Tk)

P: n/a
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
Mar 26 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

http://www.pythonware.com/library/tk...ction/text.htm

James

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

http://www.jamesstroud.com/
Mar 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.