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
2
votes
2 answers
How to set the justification of the text to "Justify" in tkinter?
I am trying to justify the text from tkinter text. The other answers (How to set justification on Tkinter Text box)said that it is my answer. I am try to use this code (I am using tkinter 8.6 and Python 3):
import tkinter
root =…

Misinahaiya
- 502
- 2
- 17
2
votes
1 answer
-textvariable option not working with ScrolledText widget in Python Tkinter
I've recently found a code in StackOverflow which inherits the Text class to add -textvariable option to it (as Text widget originally has no -textvariable option) and another code which also inherits the Text class to add a scrollbar to it by…

Yılmaz Alpaslan
- 327
- 3
- 16
2
votes
2 answers
Should I use tkinter Toplevel for Text widget or not?
I am trying to use a tkinter Toplevel window with a Text box to post to a Text box in the main window, but I keep getting the following error:
Exception in Tkinter callback
Traceback (most recent call last):
File…

egghead jr
- 91
- 10
2
votes
1 answer
how to update the index to scroll to each found word in a text box widget?
I need to consequently find each matching word add scroll to it in the text box with a button click. This function only finds the first matching word. How can I feed the updated index to a function that is bound to the button?
def find(idx='1.0'):
…

LetzerWille
- 5,355
- 4
- 23
- 26
2
votes
1 answer
TypeError: edit_undo() takes 1 positional argument but 2 were given
This is my edited code:
from tkinter import *
class UI:
def __init__(self):
self.root = Tk()
self.text= Text(self.root)
self.text.pack()
self.text.bind("", self.entry.edit_undo)
…

Alvin_Sanchez
- 91
- 7
2
votes
1 answer
how to get input from a tkinter text widget when its inside a function
relatively new to coding and currently I am playing with tkinter in python, I am using a text widget within a function and want to send the input from the text box to another function. My global variable says undefined at module level, so How could…

Kevin Nisbet
- 179
- 1
- 3
- 14
2
votes
0 answers
Fill tkinter Text widget from bottom to top
I'm creating a commands box which is made up of an entry widget and a text widget. When the user presses return on the entry widget the message is supposed to be pushed to the bottom of the text entry, instead it is pushed to the top. Not been able…

6Willows
- 43
- 7
2
votes
1 answer
tkinter text widget as html
I had built tkinter app for sending email. The body of email should get the text with formatting/style from the text widget. Is there any method for doing the same.
get method is only given the text but not the style/formatting.

ravi
- 69
- 4
1
vote
3 answers
Customtkinter: Change text color of switch
I want to change the text color of the switch widget text in customtkinter
I tried to use configure in with text_color but it showed me that there's no attribute of a switch called text_color...
Btw.. when creating the switch text_color…

Adrian8115
- 17
- 4
1
vote
1 answer
tkinter Text widget support Farsi (Arabic) letters in ubuntu
I have a Text widget in Ubuntu 22.04 and I want to write Farsi in it but it not work properly with Farsi letters, I used add_bidi_support from awesometkinter lib but for entry widget ,the library does not have any function for Text…

Mohammad Asadi
- 21
- 2
1
vote
1 answer
I have managed to insert an image into a tkinter text widget but how to make it clickable?
The following code works as far as getting the image into the text widget but I want to be able to detect when it's clicked and although that last line of code doesn't generate any errors, it doesn't work either.
my_image = ImageTk.PhotoImage(file =…

Edward
- 49
- 2
- 5
1
vote
1 answer
Tkinter Displaying Wrong Thing at Incorrect Time
I am trying to create a clicker game, and all the basic fundamentals are in; there's a button, you can click it, there's an upgrade, you can infinitely buy it while the price goes up 15%. Now, all of this is fine, but I want to implement a…

Yugm Shah
- 15
- 6
1
vote
1 answer
Tkinter insert function inserts text on to the same line all the time even when I change the line I input
scoreboard = tkinter.Text(window)
scoreboard["state"] = "normal"
scoreboard.pack()
for count, name, score in zip(range(len(names)), names, scores):
scoreboard.insert(str(float(count+1)), f"{count+1}. {name} {score}/10")
…

RedP
- 19
- 2
1
vote
1 answer
All other widgets are affected when one of the widgets move in a GUI (using the tkinter library in python 3)
Whenever I try to move individual widgets or click a button that produces words effectively moving other widgets that had nothing to do those both specified actions above.
Here is my code:
import tkinter as tk
# Create the main window
window =…

WastedxBusted
- 11
- 2
1
vote
1 answer
Tkinter ttk update label style
I am trying to update the of the background color of a text label. For this I am using the ttk module of tkinter.
For some reason it doesn't want to execute the config.xx(style="xx.TLabel.
from tkinter import *
from tkinter import ttk
win =…

Joost
- 13
- 2