问题
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:
Results of search
回答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
来源:https://stackoverflow.com/questions/45019798/how-to-divide-the-contents-of-a-tkinter-entry-with-a-number