首页 > 解决方案 > 如何修复 Kivy 的 TextInput 在使用非英文字符后不注册退格?

问题描述

我正在使用 Kivy 2.0.0 版,并且正在尝试制作一个学习外语的应用程序。但是,当我在 TextInput 对象中输入外来字符时,退格功能停止工作。

问题的图像

带有中文和重音字符的框不允许我用退格键删除,除非通过突出显示明确选择了一个文本块。

TextInput 对象的声明如下:

index = len(self.card_editor.faces)
self.card_editor.faces.append(TextInput())
self.card_editor.faces[index].font_name = "ArialUnicode"
self.card_editor.faces[index].hint_text = f"Face {index + 1}"
self.card_editor.faces[index].multiline = False

我正在使用一种支持所有 UNICODE 字符的字体,并且在使用英文字符时删除作品而不突出显示。我怎样才能让它正常删除外来字符呢?

标签: python-3.xunicodekivypython-unicode

解决方案


推荐阅读