1. <i id='44Xfo'><tr id='44Xfo'><dt id='44Xfo'><q id='44Xfo'><span id='44Xfo'><b id='44Xfo'><form id='44Xfo'><ins id='44Xfo'></ins><ul id='44Xfo'></ul><sub id='44Xfo'></sub></form><legend id='44Xfo'></legend><bdo id='44Xfo'><pre id='44Xfo'><center id='44Xfo'></center></pre></bdo></b><th id='44Xfo'></th></span></q></dt></tr></i><div id='44Xfo'><tfoot id='44Xfo'></tfoot><dl id='44Xfo'><fieldset id='44Xfo'></fieldset></dl></div>
    <tfoot id='44Xfo'></tfoot>

      • <bdo id='44Xfo'></bdo><ul id='44Xfo'></ul>

      <small id='44Xfo'></small><noframes id='44Xfo'>

    1. <legend id='44Xfo'><style id='44Xfo'><dir id='44Xfo'><q id='44Xfo'></q></dir></style></legend>

      Kivy 的 TextInput 小部件中的 Tab/Enter(和其他击键)处理

      时间:2023-06-07

        <tfoot id='mD6WO'></tfoot>

          <small id='mD6WO'></small><noframes id='mD6WO'>

          • <bdo id='mD6WO'></bdo><ul id='mD6WO'></ul>
            <i id='mD6WO'><tr id='mD6WO'><dt id='mD6WO'><q id='mD6WO'><span id='mD6WO'><b id='mD6WO'><form id='mD6WO'><ins id='mD6WO'></ins><ul id='mD6WO'></ul><sub id='mD6WO'></sub></form><legend id='mD6WO'></legend><bdo id='mD6WO'><pre id='mD6WO'><center id='mD6WO'></center></pre></bdo></b><th id='mD6WO'></th></span></q></dt></tr></i><div id='mD6WO'><tfoot id='mD6WO'></tfoot><dl id='mD6WO'><fieldset id='mD6WO'></fieldset></dl></div>
            1. <legend id='mD6WO'><style id='mD6WO'><dir id='mD6WO'><q id='mD6WO'></q></dir></style></legend>

                  <tbody id='mD6WO'></tbody>
                本文介绍了Kivy 的 TextInput 小部件中的 Tab/Enter(和其他击键)处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 Kivy 框架编写一个应用程序,我偶然发现了一个小而烦人的问题:我不知道如何处理文本字段中的 Tab/Enter/Arrow 键,以便按下任一其中会派发一个事件,例如.将焦点(跳转)到另一个 TextInput 或启动类似 send_form()

                I'm writing an app using Kivy framework and I stumbled upon a minor but annoying problem: I don't know how to handle Tab/Enter/Arrow keys in text fields so that pressing either of them would dispatch an event, eg. switch the focus (jump) to another TextInput or launch something like send_form()

                谁能解释一下这个问题?

                Could anyone please shed some light on this issue?

                推荐答案

                正如 Daniel Kinsman 在他的评论中所建议的,您可以继承 TextInput,添加上一个"和下一个"ObjectProperties 以支持选项卡(易于在 kv 中使用引用其他小部件),并以不同的方式处理键盘事件.目前没有开箱即用的支持,但如果您想进行此类修改,请向我们发送功能请求或在 freenode 上的#kivy 中讨论它.

                As suggested by Daniel Kinsman in his comment, you could subclass TextInput, add "previous" and "next" ObjectProperties for tab support (easy to set in kv using references to other widgets), and handle the keyboard events differently. There is no out of the box support for this right now, but if you want to work on such modification drop us a feature-request or comme discuss it in #kivy on freenode.

                https://github.com/kivy/kivy/blob/master/kivy/uix/textinput.py#L1188

                也许在小部件上添加这样的支持会更好,并添加一些焦点逻辑,因此 tab/enter 对任何可激活的小部件都有影响,并且像滑块这样的一些小部件也使用右/左/上/下键.

                Maybe it would be even better to add such support on widget, and add some focus logic, so tab/enter have effects on any activable widget, and some widgets like slider use right/left/up/down keys too.

                因此,在 Kivy 中还有很多工作要做,如果您有兴趣提供帮助,您真的可以更快地实现,我们会帮助您:)

                So there is still a lot to do in Kivy about that, and if you are interested in helping, you can really make it happen faster, we'll help you :)

                这篇关于Kivy 的 TextInput 小部件中的 Tab/Enter(和其他击键)处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:有哪些 Kivy 教程可用 下一篇:基维外观和感觉

                相关文章

                  <bdo id='vG2aP'></bdo><ul id='vG2aP'></ul>

              1. <i id='vG2aP'><tr id='vG2aP'><dt id='vG2aP'><q id='vG2aP'><span id='vG2aP'><b id='vG2aP'><form id='vG2aP'><ins id='vG2aP'></ins><ul id='vG2aP'></ul><sub id='vG2aP'></sub></form><legend id='vG2aP'></legend><bdo id='vG2aP'><pre id='vG2aP'><center id='vG2aP'></center></pre></bdo></b><th id='vG2aP'></th></span></q></dt></tr></i><div id='vG2aP'><tfoot id='vG2aP'></tfoot><dl id='vG2aP'><fieldset id='vG2aP'></fieldset></dl></div>
                  <legend id='vG2aP'><style id='vG2aP'><dir id='vG2aP'><q id='vG2aP'></q></dir></style></legend>

                  1. <small id='vG2aP'></small><noframes id='vG2aP'>

                    <tfoot id='vG2aP'></tfoot>