Questions tagged [tkinter-text]

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.

207 questions
1
vote
1 answer

Align text to left with Tkinter

I'd like to align my text to the left but anchor='w' does not seem to work... Any tips ? from tkinter import Tk, Label window = Tk() lab = Label(window, text = 'hey', anchor='w') lab2 = Label(window, text='hellooooooo',…
thomb734
  • 11
  • 2
0
votes
2 answers

TkinterDnD2 return value

I'm trying to make a tkinterdnd function that when called on can allow the user to drag and drop a file into the box, and when the box is closed it returns the file path for the file put in as event_data. How do I get it to return this value if it…
Agent859
  • 5
  • 3
0
votes
1 answer

How can I modify my tkinter code to highlight at different moments multiple occurrences of a word in a Text widget?

I've got the following code to highlight word-matches within a tk.Text. However, this code will highlight all matches it finds all at once (e.g. if the sentence is "my cat is my friend", it would highlight all occurrences of "my" at the first time I…
Alex
  • 3
  • 2
0
votes
1 answer

Is there a way to display text at one level in 3 separated tk.Text boxes?

I make my program with tkinter. Program stores some information in array([[aaa, bbb, ccc],[ddd, eee, fff]]) and I want to display it in 3 text boxes. The first box will contain aaa and ddd, other 2 will contain data in same way. But I don't know how…
0
votes
1 answer

Adding a resizable scroll-bar in Tkinter GUI

I am new to Tkinter. I am trying to add a scroll-bar in the GUI that I created using Tkinter. I added the scroll-bar using the following program. But, the problem is that, when I resize my window using mouse cursor, the size of the scrollbar also…
0
votes
1 answer

Why the last url opens in a webbrowser even if I click on another url in my tkinter Text widget?

Why google.com opens (the last url) if I click on example.com? Here is my code: import tkinter as tk import webbrowser window = tk.Tk() output = tk.Text(window) output.pack() def update_output(new_text): output.insert(tk.END, new_text) if…
0
votes
0 answers

Redirect Python Terminal in real time to CustomTkinter CTK textbox

This is a simple customtkinter code with a textbox area. import import customtkinter as ctk def print_something(): print ('Print some text\n' * 50) # Appearance window ctk.set_appearance_mode('system') # Modes: system (default), light,…
Chris
  • 13
  • 2
0
votes
1 answer

Text widget expands wide without being asked to do that (other elements don't expand)

Building a GUI app, and I'm using Tkinter with ttkbootstrap. Despite all problems and weird/inconsistent experience with Tkinter, I managed to build a functional GUI app, but I can't style it properly, because Tkinter behaves in unstable manner. The…
Ilya
  • 992
  • 7
  • 14
0
votes
3 answers

How to save tkinter textbox content as a string variable?

I'm having trouble learning how to save a textbox input in tkinter as a string variable. This is what I have so far. from tkinter import messagebox class Setup: def __init__(self): #layout of setup window self.root =…
livymio
  • 11
  • 3
0
votes
1 answer

How do you grab the Text widget data from Tkinter in order to freely use the data?

I am trying to make use of the input text data that is entered through Tkinter's Text widget, the same way one would be able to use the data, it if the data was entered using the input() method in python. Here is my sample…
Monk
  • 41
  • 6
0
votes
0 answers

How can I display image and text at the same time

`def calculate(): actual_age = int(actual_age_entry.get()) if actual_age > 9: min_age = int(min_age_entry.get()) if min_age < actual_age: min_base = get_minimum_base(actual_age, min_age) …
0
votes
1 answer

Tkinter unable to clear the label

import tkinter import random import time score = 0 num1 = random.randint(1, 10) num2 = random.randint(1, 10) result = num1 + num2 timeleft = 30 def add(): return num1 + num2 def mul(): return num1 * num2 def div(): return num1 //…
0
votes
0 answers

Tag_add function in tkinter generates "_tkinter.TclError: bad text index "0" "

In my python tkinter program, in which the user is entering text into a text widget, my program is supposed to compare two texts (one which is given, and another which the user is typing in said entry widget). After comparing texts, it is supposed…
0
votes
1 answer

Tkinter - How to resize frame containing a text widget (in all directions)?

I'm trying to resize certain layered tkinter components, mostly because I'm curious. Right now, seems stuck in trying to resize a frame containing a text widget. here is my attempt: import tkinter as tk def make_draggable(widget): …
Nordine Lotfi
  • 463
  • 2
  • 5
  • 20
0
votes
0 answers

Tkinter Text Widget Font Bug

Run the code for it to make sense, go to Appearance >> Font >> Size, No matter what, the font size turns to 48 and config.json has font size also equal to 48. I tried logging Root.Size >> s in the function and and print the sizes while generating…
DELTA
  • 11
  • 3