Python Forum
[Tkinter] How to wrap text within text box
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to wrap text within text box
#1
Hi all,

I need some help with this project. I cannot find the command to wrap text that I've already imputted into the widget. What I want to do get rid of line breaks when I push the 'wrap' button.

Here is my code so far.

from tkinter import *

from tkinter import scrolledtext
import textwrap

window = Tk()

window.title("Welcome to LikeGeeks app")

window.geometry('500x500')

txt = scrolledtext.ScrolledText(window,width=50,height=20)

txt.grid(column=0,row=0)

btn1 = Button(window,text='Clear', command=lambda: txt.delete(1.0,END))
btn2 = Button(window,text='Wrap', command=lambda: textwrap)

btn1.grid(column=4, row=15)
btn2.grid(column=8, row=15)



window.mainloop()
Reply


Messages In This Thread
How to wrap text within text box - by pav1983 - May-15-2020, 06:02 PM
RE: How to wrap text within text box - by DT2000 - May-15-2020, 08:16 PM
RE: How to wrap text within text box - by pav1983 - May-16-2020, 11:08 PM
RE: How to wrap text within text box - by pav1983 - May-17-2020, 04:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Transparent window background, but not text on it muzicman0 7 2,905 Feb-02-2024, 01:28 AM
Last Post: Joically
  [Kivy] Create a function to store text fields and drop downs selection in KivyMD floxia 0 1,677 Dec-18-2022, 04:34 AM
Last Post: floxia
  [Tkinter] Updating tkinter text BliepMonster 5 6,100 Nov-28-2022, 01:42 AM
Last Post: deanhystad
  Can't change the colour of Tk button text Pilover 6 14,840 Nov-15-2022, 10:11 PM
Last Post: woooee
  [PyQt] QLineEdit Caret (Text Cursor) Transparency malonn 5 2,838 Nov-04-2022, 09:04 PM
Last Post: malonn
  [PyQt] Hover over highlighted text and open popup window DrakeSoft 2 1,541 Oct-29-2022, 04:30 PM
Last Post: DrakeSoft
  [PyQt] Determine whether text in QTableView cell is fully visible or not random_nick 0 996 Oct-27-2022, 09:29 PM
Last Post: random_nick
  [PyQt] [Solved]Change text color of one line in TextBrowser Extra 2 4,935 Aug-23-2022, 09:11 PM
Last Post: Extra
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 4,954 Jun-26-2022, 06:26 PM
Last Post: menator01
  [PyQt] Determining the format attributes on text in a QTextEdit object DrakeSoft 7 3,590 Apr-18-2022, 06:40 PM
Last Post: DrakeSoft

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020