如何用数字划分 TkInter 条目的内容? [英] How to Divide the Contents of a TkInter Entry With a Number?
问题描述
我一直在试图弄清楚如何用数字(准确地说是浮点数)划分 TkInter 输入框的内容.我查了一下 搜索结果
使用浮点数从输入框分割输入:如果您希望 entrybox 为 int 形式而不是浮动,请使用 int()
num = 3.0temp = float(entrybox.get())划分 = 温度/数量
或分割/拆分字符串:
temp = entrybox.get().split(" ")# 在语音标记中输入要拆分的内容
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:
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
这篇关于如何用数字划分 TkInter 条目的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!