在KV文件中单击时更改TextInput文本
即时通讯,当用户单击其中时,试图更改文本插图的文本。 IVE尝试了DEF ON_ENTER,但是在整个文件中使用了屏幕,因此在窗口外。
def test(self, *args):
self.ids.text_input.text = "test"
#self.ids.text_input.bind(on_text_validate = self.test)?
TextInput:
multiline: False
id: text_input
text:'00:00'
on_enter: app.test() #? problem area
on_press: app.test() #? problem area
Im trying to change the text of the textinput when the user clicks into it. ive tried the def on_enter, but in the whole file im using a screen, so thats out the window.
def test(self, *args):
self.ids.text_input.text = "test"
#self.ids.text_input.bind(on_text_validate = self.test)?
TextInput:
multiline: False
id: text_input
text:'00:00'
on_enter: app.test() #? problem area
on_press: app.test() #? problem area
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
on_focus
而不是on_enter
或on_press
:然后,
app
中的方法可以是:You can use
on_focus
instead ofon_enter
oron_press
:Then the method in the
App
can be: