'How to Divide the Contents of a TkInter Entry With a Number?
I've been trying to figure out how to divide the contents of a TkInter entry box with a number (a float, to be precise). I looked it up on Google, and I found nothing that answered my question, other than doing .get()
for getting a number from a entry. I want to have a number already there (or have a static variable) that I can divide to get the results I need.
Any help would be appreciated! Thanks a billion!! :D
P.S. Here's the website results I saw before I posted this question:
Solution 1:[1]
To divide an input from entrybox using float: if you want entrybox to be in int form not float use int()
num = 3.0
temp = float(entrybox.get())
divided = temp / num
or divide/split a string:
temp = entrybox.get().split(" ")# enter what to split by in speech marks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Enchant97 |