Python Forum
[Tkinter] Get the last entry in my text widget
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Get the last entry in my text widget
#1
I want to get the last entry in my text widget.

This writes an entry to the text widget (thanks to Menator01):

def printit(text):
        #text_area.delete(0.0, tk.END)
        text_area.insert(tk.END, text.get() + '\n')
I can't see how to assign this directly to a variable. But I can use:

def retrieve_input():
        #input = self.myText_Box.get("1.0",'end-1c')
        answer = text_area.get(X)
to get all the text.

What value must X have to get the last entry, the last line, in the text widget? I need to do this a few times.
Reply


Messages In This Thread
Get the last entry in my text widget - by Pedroski55 - Jul-13-2020, 04:05 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ValueError: could not convert string to float: '' fron Entry Widget russellm44 5 4,666 Mar-06-2024, 08:42 PM
Last Post: russellm44
  [Tkinter] entry widget DPaul 5 3,592 Jul-28-2023, 02:31 PM
Last Post: deanhystad
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 10,518 Jun-26-2022, 06:26 PM
Last Post: menator01
  Tkinter Exit Code based on Entry Widget Nu2Python 6 6,421 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  [Tkinter] Text widget inert mode on and off rfresh737 5 5,626 Apr-19-2021, 02:18 PM
Last Post: joe_momma
  Line numbers in Text widget rfresh737 3 8,030 Apr-15-2021, 12:30 PM
Last Post: rfresh737
  tkinter text widget word wrap position chrisdb 6 10,563 Mar-18-2021, 03:55 PM
Last Post: chrisdb
  method to add entries in multi columns entry frames in self widget sudeshna24 2 3,110 Feb-19-2021, 05:24 PM
Last Post: BashBedlam
  Entry Widget issue PA3040 16 9,764 Jan-20-2021, 02:21 PM
Last Post: pitterbrayn
  [Tkinter] password with Entry widget TAREKYANGUI 9 9,285 Sep-24-2020, 05:27 PM
Last Post: TAREKYANGUI

Forum Jump:

User Panel Messages

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