python - Automatic input jump tkinter
问题描述
I am new to python and my question is if there is a way to enter data in an entry and when it reaches the indicated number of characters it will automatically jump to the next entry
I need something like this
解决方案
如果您想这样做,我强烈建议您使用该.trace()
方法。此方法在后台执行的操作 --> 每当触发所述条件时,它都会调用一个函数。例如:
name_of_stringvar = StringVar()
Entry(root, textvariable = name_of_stringvar)
name_of_stringvar.trace('w', function_name)
因此,每当在 中输入内容时Entry()
,它都会转到函数(function_name
在这种情况下)。您可以说明检查第一个条目的最大字符数的条件。然后当超出限制时,使用该focus_force()
方法将光标移动到第二个条目。
推荐阅读
- php - 读取 CSV 在不同的计算机上给出不同的输出
- javascript - 模式适用于 regex101 但不适用于 Google 脚本
- node.js - 如何将 Node.js 应用程序部署到远程服务器?
- python - 使用 gdata-python-client 和 OAuth2 令牌从 Google Contacts API 检索所有(其他)联系人?
- delphi - 将多个列表框值保存到单个文本文件中
- javascript - Mozilla 插件中的模块和动态导入
- matlab - 如何将 EditField 值转换为元胞数组?
- sql-server - 如何在触发器中获取“仅更新列”的名称?
- jquery - 在数组中查找对象
- python-3.x - 如何为 python 的 requests.Response.text 属性设置值?