Questions tagged [tkinter.text]

14 questions
12
votes
2 answers

Python tkinter text modified callback

In python 2.7, I am trying to get a callback every time something is changed in the Tkinter Text widget. The program uses multiple frames based on code found here: Switch between two frames in tkinter? The callback part is taken from the following…
additive
  • 135
  • 1
  • 1
  • 7
10
votes
3 answers

Explain Tkinter text search method

I don't quite understand how text.search method works. For example there is a sentence: Today a red car appeared in the park. I need to find a red car sequence and highlight it. It is found but here is how my highlighting looks like: I am using…
minerals
  • 6,090
  • 17
  • 62
  • 107
1
vote
1 answer

Why doesn't the end index 2.0 terminate the get function at the beginning of line 2?

I'm having trouble capturing a Tkinter Text's widgets first line of code. Under two conditions, with and without a newline char inputted into the input text widgets field. Further more I'd like to capture the second line of code then the third…
1
vote
0 answers

How do I keep style information (tags) when undoing and redoing in a Tkinter Text?

I am writing an html editor in Python 3.7.4 / Tkinter 8.6 / Windows 10.0.18362.356, and am using tags to style text for , etc. However, the inbuilt undo/redo mechanism deletes these tags, for instance, if I redo immediately after…
1
vote
1 answer

Replace specific word in Tkinter Text widget

I was wondering if there's a way to replace all instances of a specific word in the Tkinter Text widget. E.g. Pretend this is my text widget: Hello how are you? How is the weather? I want to press a button and replace all instances of the word 'how'…
jack.py
  • 362
  • 8
  • 23
1
vote
1 answer

find index of elements created with window_create inside tkinter Text

I used window_create to create interactive buttons inside a Text element. The buttons represent random or static values and I want to be able to compile the contents of the text element and replace the buttons with their respective values. However,…
Ethan
  • 122
  • 10
1
vote
2 answers

Tkinter Text Widget Ctrl+A + DEL deletes tag

In Text Widget when I delete all text with Ctrl + A + DEL, the tag is deleted. How to fix it? This is tag code: def _ingrandisci(self,event=None): BloccoNote._c+=1 self._testo.tag_config("i", font=("Consolas", BloccoNote._c)) …
antonio
  • 59
  • 6
1
vote
1 answer

Select only the texts not the whole line in tkinter

I'm trying to select only the entered words in a ScrolledText but the whole line is getting selected. Select all code: # I'm using ScrolledText for the input field self.textBox = ScrolledText.ScrolledText(master=self.topFrame, wrap="word",…
Soumyajit
  • 329
  • 1
  • 5
  • 16
0
votes
1 answer

How to switch between two tkinter frames

I am trying to switch and display two frames in tkinter using the codes below but I am not succeeding. I have attached an image of what the code is displaying. from tkinter import* root= Tk() root.title("HOSPITAL MANAGEMENT SYSTEM") …
0
votes
1 answer

how can i get input from Text in tkinter in python 3.8

I wanted to get input from a tkinter.Text object in python msg = tkinter.StringVar() message = tkinter.Entry(mainframe, textvariable=msg) but it gives an error I also tried the get method thetext = message.get('1.0', 'end') but it gives this…
0
votes
1 answer

Print tabular formated text into a tk.Text widget, not aligned as its supposed

I couldn't found answer on the internet so I'm hoping you can help me. I'm trying to print from a list into a text box in Tkinter. From some reason, when I print it to text box it's not aligned as its supposed to be but when I print it to the…
0
votes
1 answer

Best way to save the contents and configuration of a tk.Text widget?

I have a tkinter Text widget that contains text, tags, and some tkinter Labels. Is it possible to take the current configuration of this Text widget T, save it to a file, and destroy T, then later start a new instance of a Text widget t, load the…
Curtis Pro
  • 19
  • 3
0
votes
1 answer

Read one line at a time from tkinter textbox

I can read one line at a time, from an input box, and display it in a new box, but I need to advance to the next line of code. Here are the text boxes in the GUI self.sourcecode = Text(master, height=8, width=30) self.sourcecode.grid(row=1,…
0
votes
1 answer

Check if a string is a word or part of a word in Tkinter Text Widget

I am working on a spellchecker for a tkinter text widget. I've got it working so that the user can select an incorrect word and replace all instances of the incorrect word in the text widget. However, if the word appears within another word, it will…
jack.py
  • 362
  • 8
  • 23