Best practice for TextInput validation in kivy/kv

狂风中的少年 提交于 2019-12-11 11:34:44

问题


I'm designing a GUI for android with kivy. There are many TextInput-fields, most of them need some kind of validation. What I've found so far is, that on_text_validate would allow for plausibility checks, but only if the user leaves that field with ENTER, which is rarely the case in an android-environment. How can I achieve checks if the user sets the focus to another widget by tapping? Doing this (allways) with on_text seems a bit weird to me, but maybe it's possible. A simple example: how would you make sure that the user is only able to insert integers and that the value is in a definite range? The other question I would like to ask: how is it possible to deactivate a TextInput depending on the value of previous inputs or to set the focus appropriately? I think these are standard tasks in GUI-programming and I'm a bit confused on how to manage these in kivy - help would be very appreciated!

来源:https://stackoverflow.com/questions/33464998/best-practice-for-textinput-validation-in-kivy-kv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!