How to get Tkinter input from the
I asked this question to help others with the same problem - that is the reason why there is no example code. This issue had been troubling me for hours and I used this question to teach others. Please do not rate it as if it was a real question - the answer is the thing that matters.
To get Tkinter input from the text box, you must add a few more attributes to the normal
.get() function. If we have a text box
myText_Box, then this is the method for retrieving its input.
def retrieve_input(): input = self.myText_Box.get("1.0",END)
The first part,
"1.0" means that the input should be read from line one, character zero (ie: the very first character).
END is an imported constant which is set to the string
END part means to read until the end of the text box is reached. The only issue with this is that it actually adds a newline to our input. So, in order to fix it we should change
end-1c(Thanks Bryan Oakley) The
-1c deletes 1 character, while
-2c would mean delete two characters, and so on.
def retrieve_input(): input = self.myText_Box.get("1.0","end-1c")
It would be easy for me to develop native apps using Java, C++ or Objective-C and I am also able to learn Kotlin, Dart or Swift, but things are much easier when you just use Python. I have done a Djan...
Pandas 1.x Cookbook: Practical recipes for scientific computing, time series analysis, and exploratory data analysis using Python, 2nd Edition....
In the last decade, we have seen the impact of exponential advances in technology on the way we work, shop, communicate, and think. At the heart of this change is our ability to collect and gain insig...
Professional-quality code does more than just run without bugs. It’s clean, readable, and easy to maintain. To step up from a capable Python coder to a professional developer, you need to learn indu...