How to use "keyboard enter" for the text input.

1,335 views
Skip to first unread message

Ayhan Celik

unread,
Jul 21, 2019, 7:15:58 AM7/21/19
to Kivy users support
Hi I have a textinput and button.
Button is good working but when I writte in textinput than press the keyboard enter button my app is shutdown. ??

How do I use the enter key from the keyboard keys in the textinput area????

Elliot Garbus

unread,
Jul 21, 2019, 9:06:57 AM7/21/19
to kivy-...@googlegroups.com
Please share a small example. There should be no problem using the enter key. 
What does the trace back show.?

Sent from my iPad
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/456885e5-b72d-477a-b029-90df77aeccb5%40googlegroups.com.

Ayhan Celik

unread,
Jul 21, 2019, 9:23:40 AM7/21/19
to Kivy users support
Related sections at the bottom...


py

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.graphics import Line,Color,InstructionGroup
from kivy.uix.button import Button
from kivy.properties import ObjectProperty
from kivy.core.window import Window
from kivy.uix.widget import Widget
from kivy.uix.scatterlayout import ScatterLayout
from kivy.uix.popup import Popup
from kivy.uix.textinput import TextInput
from kivy.core.audio import SoundLoader
from random import random
from kivy.config import Config
import os

def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
        if self.ism.focus and keycode == 'enter':
            app.puko()



kv

TextInput:

            id:ism

            size_hint:0.7,0.2

            multiline: False

            font_size:20

            on_text_validate:

                app.puko()

            on_focus: root._on_keyboard_down(self)   


On Jul 21, 2019, at 4:15 AM, Ayhan Celik <ayhan...@gmail.com> wrote:

Hi I have a textinput and button.
Button is good working but when I writte in textinput than press the keyboard enter button my app is shutdown. ??

How do I use the enter key from the keyboard keys in the textinput area????

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-...@googlegroups.com.

Alexander Taylor

unread,
Jul 21, 2019, 10:54:20 AM7/21/19
to Kivy users support
Please post a minimal runnable example, i.e. a complete app that can be run to reproduce the issue.

Prabhat Mohanty

unread,
Jul 21, 2019, 12:39:58 PM7/21/19
to Kivy users support
Typically, the Enter button "validates the text in the Text Input box and then removes the focus from the text input box. You may call a function on_text_validate: root.someFunction()

If the multiline=True, then the Enter key will take you to the next line.
Reply all
Reply to author
Forward
0 new messages