The Text widget is a generalized method for displaying multiple lines of text and embedded images and windows. It also provides ways to change both the appearance and functionality of its contents — i.e. font, size, and color. You can also make the text, widgets, or embedded images respond to keyboard or mouse actions. The appearance and functional features can be controlled by associating them tags, which may be associated with multiple pieces of text.
Questions tagged [tkinter-text]
207 questions
1
vote
1 answer
Clear Text Widget for new text entry on every button press
I am trying to clear or reset a text box and store new results. Basically, every time i press the button, I would like the text box to be emptied before the new text is stored.
In my research the following thread popped up and he seems to have a…

Blackmagic42
- 83
- 1
- 8
1
vote
0 answers
Horizontal insertion cursor on a tkinter text widget?
Me and my friend are making something similar to a command prompt on Python using tkinter, but we're struggling to replicate the horizontal insertion cursor as shown here.
We're using an text widget in order to try and do this, and we've got…

CharacterLimit
- 33
- 4
1
vote
1 answer
Tkinter Texboxes Becoming Transparent On A Button Click
from tkinter import Tk, scrolledtext, INSERT, Button, PhotoImage, Label, Text
root = Tk()
root.geometry('1000x550')
bg = PhotoImage(file='./assets/bg.png')
root.resizable(False, False)
root.title('Testing Classes')
window = Label(root,…

Hunter
- 188
- 2
- 11
1
vote
1 answer
How to duplicate tkinter widgets?
How to duplicate tkinter text widget so that you can add it in every Notebook tab? I am writing an editor using tkinter, and I have also added undo functions. The problem is, when I add a new tab, the undo function works only for that tab. When I…

Michael Clarkson
- 11
- 1
1
vote
1 answer
Why cant I type into a tkinter Text widget?
I have the following code for my program:
main = Tk()
text = Text(main).place(relx=0.5, rely=0.5, anchor=CENTER)
Button(main, text="SEND", command=_tosend).place(relx=0.3, rely=0.8, anchor=CENTER)
Button(main, text="BACK", command=lambda:…
user13524876
1
vote
1 answer
How can I use text with html tags in a tkinter text box, or change it so that it works in a tkinter label?
I've been given a lot of text and asked to display it in a tkinter app. The text has a lot of html tags like ...<\em>, and ...<\sup> where the text needs to be italicized or superscript.
Is there any way built into tkinter to do this? If…

AdeDoyle
- 361
- 1
- 14
1
vote
1 answer
Redo Not Working on Windows for Tkinter Text Widget
I'm sorry if this is a stupid question, but I'm not sure what I am doing wrong here. The undo and redo worked perfectly fine on Linux but it will not work on Windows. I tried to create a binding manually (as seen below) but that also didn't solve…

Seth Walker
- 11
- 1
1
vote
1 answer
Is there good way to save text input from tkinter Text widget
I was building, a receipt using Tkinter in Text widgets, it is well-formatted in GUI
but when I save that it becomes like this
There is so much disorder in the text file
How can I get a text formatted like one in GUI, in text file ???
here is my…

Thierry Mugisha
- 119
- 10
1
vote
1 answer
Tkinter: highlight selected text with color on a keyboard input
I am new to Tkinter and I am trying to build an annotation tool wherein I want the text selected by the user to get highlighted with some color when a keyboard key is pressed. This is my code until now.
from tkinter import *
import tkinter as…

Abhibha Gupta
- 61
- 1
- 5
1
vote
1 answer
How to prevent the widgets inside text from moving beyond the boundary? Tkinter
I have a Text widget in which there are a stack of widgets inserted as a window. Whenever I scroll, the widgets move beyond the Text boundaries until their end crosses over. Here is a sample code that produces a similar symptom.
from tkinter import…

astqx
- 2,058
- 1
- 10
- 21
1
vote
1 answer
Tkinter window_create in text widget overlaps other GUI
I'm making a chat using Python 3.8 and Tkinter.
I have implemented colored text via window.create() method of Text widget.
But when you start scrolling up, this text overlaps the rest of the program's interface. How can I fix this?
Here's code that…

Зелди
- 76
- 1
- 12
1
vote
1 answer
In my calculator, how do I have it only solve an equation once, and prevent user input after until calculator is cleared?
I am creating a calculator using tkinter, and I am having a hard time figuring out how I can only make the calculator solve what ever the user input once, and prevent further input into the next line (My output text widget has only two lines). I…

DatoPotato Games
- 19
- 3
1
vote
2 answers
How do I stop text from cutting off in the tkinter text widget in Python 3.7?
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…
user11063427
1
vote
3 answers
Tkinter text widget - Why does INSERT not work as text index?
I have a problem that annoys me. I am currently building a small app with a Tkinter GUI.
On the front page, I want some introductory text in either a text or a scrolledtext widget. The code examples I've come across uses keywords such as INSERT,…

Anders F.
- 23
- 1
- 5
1
vote
1 answer
how can I add an auto indent feature after colon in tkinter gui in python?
I am making a text editor it has all the features but not an auto-indent feature which can automatically add spaces after loops or conditions. Please tell me how can I make, and please try to give a code which can do it. I am making this in Tkinter…

Kumar Saptam
- 336
- 5
- 18