_tkinter.tclerror:预期的浮点数,但获得了“” (当我的变量变为空时)

发布于 2025-02-12 10:44:01 字数 234 浏览 0 评论 0原文

这是我第一次寻求帮助。我不是真正的专家,所以我希望这不是一个新的问题(对不起,如果是)。 尝试执行一个简单任务(尝试获取变量的Lenght)的程序

if len(str(Precio.get()))>10:

在我

无论如何,

中扣除,我正在使用tkinter。 precio是doubleVar()类型。 每当变量空白时,此错误似乎都会到达。 提前致谢!

this is my first time asking for help. I am not really an expert, so I hope this is not a newby question (sorry if it is).
Anyway, in a program in which I try to do a simple task (trying to get the lenght of a variable) with this expression:

if len(str(Precio.get()))>10:

I get this error:

_tkinter.TclError: expected floating-point number but got ""

As you have already deducted, I´m using Tkinter. Precio is DoubleVar() type.
This error seems to arrive whenever the variable gets empty.
Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文