Categories
Python Answers

How to get the input from the Tkinter Text Widget with Python?

Spread the love

Sometimes, we want to get the input from the Tkinter Text Widget with Python.

In this article, we’ll look at how to get the input from the Tkinter Text Widget with Python.

How to get the input from the Tkinter Text Widget with Python?

To get the input from the Tkinter Text Widget with Python, we can use the get method.

For instance, we write

def retrieve_input():
    input = self.myText_Box.get("1.0", END)

to call the myText_Box.get method with '1.0' and END to get the input value from the myText_Box text box.

'1.0 means the input should be read from line 1 character 0.

And END is a tkinter constant that makes tkinter read the input until the end of the text box is reached.

Conclusion

To get the input from the Tkinter Text Widget with Python, we can use the get method.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *