faqts : Computers : Programming : Languages : Python : Tkinter

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 3 people (67%) answered Yes
Recently 2 of 3 people (67%) answered Yes

Entry

How do I force a canvas text object to stay within a rectangle?

Feb 14th, 2005 21:54
Martin Franklin, Mickel Grönroos,


You could use the width option of the text object:
c = Canvas(root)
c.create_text(10, 10, text="A very long string indeed", width=5)
but this will split it every 5th pixel... better off inserting line 
feeds where you want them!
c.create_text(10, 10, text="A very long\nstring indeed", width=5)