The text box is working, I can type in it, move it around and stuff but when my sentence reaches the end of the text widget, the last word just gets cut in half and moves the second half of the word to the next line. Is there any way I can prevent this?
Asked
Active
Viewed 1,464 times
1
-
1Did you try using the `wrap` option? – acw1668 Apr 12 '20 at 12:35
-
@acw1668 I've never heard of it, what does it do and how do I use it? Thanks! – Apr 12 '20 at 12:45
-
1See the [document](http://effbot.org/tkinterbook/text.htm#Tkinter.Text.config-method). – acw1668 Apr 12 '20 at 12:52
-
@acw1668 Thank you! I fixed my problem by setting the wrap parameter to tkinter.WORD. – Apr 12 '20 at 12:54
2 Answers
1
This worked great for me.
If you add wrap=WORD to the parameters (or tk.WORD depending on how you imported tkinter) it won't cut your word in half if it reaches the end of a line, instead it will automatically make a new line if the word is too long
Text = tk.Text(root, height=13, width=20, wrap=WORD)

Oliver
- 11
- 5
0
Username acw1668 shared the document on the text widget and told me to look for the wrap parameter. I found that if you set the wrap parameter to tkinter.WORD, then the problem would be fixed.