--
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/179b1716-5d83-42ac-b64d-2211fb7215c4%40googlegroups.com.
Here are some suggestions. I don’t have any experience with Android – but expect that this approach will solve the problem.
First confirm your assumption that the Window.bind() in the __init__() is causing the keyboard to open from by commenting it out.
If that is the problem, then there are a few places that you can try moving it.
Screens have an on_enter event. You could move the bind to the on_enter event for the screen. Alternatively, TextInput has an event on_focus that fires when the TextInput widget goes in or out of focus. You could bind/unbind in the on_focus event.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71Epof%2BwYjMQ7F2-mXm-ZQnB78SuhGzB43CdyzwNTesqz%2BQ%40mail.gmail.com.
On Mon, Mar 2, 2020 at 12:56 AM ZenCODE <zenkey...@gmail.com> wrote:
--The code is unreadable, un-indented and with no imports. Please post the complete, runnable code.Thanks
On Saturday, February 29, 2020 at 6:59:31 PM UTC+2, Anoop Rana wrote:I have created an app and used window.bind(on_keyboard=self.some_function) as i am listening for keyboard event press.Everything is working but when the app opens up a keyboard is popping up automatically.I don't want the keyboard to open up auomatically when the app starts.Is there a way to do that?
Here is the code i'm using:
`class SecondWindow(Screen):
def init(self,**kwargs):
super(SecondWindow,self).init(**kwargs)
self.screen_list=[]
Window.bind(on_keyboard=self.Android_back_click)
def Android_back_click(self,window,key,*largs):
if key == 27:
print(self.manager.current)
if(self.manager.current=='main'):
print("Hello")`
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.
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/3a1d5a72-0f3c-4e67-a403-6dcccb3f5459%40googlegroups.com.
On Mar 9, 2020, at 6:27 AM, Anoop Rana <anoopr...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71Eo3WW9cbw3qXv-qrLpEjcH8EdwXWb4ysBHkn71UGtTyCg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/1F3DA218-8E2F-4D9D-981F-9D8113CCAAC1%40cox.net.
Try putting it in the on_focus event, it further narrows when the bind would be called. I suggest binding when the TextInput is in focus, and unbinding when focus is lost.
From: Anoop Rana
Sent: Monday, March 9, 2020 7:20 AM
To: kivy-...@googlegroups.com
Subject: Re: [kivy-users] Re: How to stop keyboard from automatically poppingup when app starts
I used on_enter as you suggested but the keyboard stillI pops-up automatically.I used the following code(something like this):
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71EoD7YT5eJSFqmP9O6ObXA%3DoQANW9i6zD10AaGci%3DmvGrQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5e66547c.1c69fb81.e0707.60f1SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Here is an example let me know if this helps.
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.textinput import TextInput
from kivy.properties import NumericProperty
from kivy.core.window import Window
class CharLimitTextInput(TextInput):
max_characters = NumericProperty(8) # sets the max number of chars the user can input
def __init__(self, **kwargs):
super().__init__(multiline=False, **kwargs) # Note: Multiline is False
def insert_text(self, substring, from_undo=False):
if len(self.text) < self.max_characters:
ss = substring if substring.isascii() else '' # Only accept ASCII Strings
return super().insert_text(ss, from_undo=from_undo)
def on_text_validate(self): # Runs when enter is pressed, because multiline is false
if len(self.text) >= self.max_characters:
self.text = self.text[0:self.max_characters]
return super().on_text_validate()
def on_focus(self, _, focus): # Validate text if focus is lost
if focus: # The TextInput is in focus
print('Text Widget in Focus')
Window.bind(on_keyboard=self.echo_key)
else:
Window.unbind(on_keyboard=self.echo_key)
print('TextInput Widget lost focus')
def echo_key(self, win, key, scancode, codepoint, modifier):
print(f'{self}, {win}, {key}, {scancode}, {codepoint}, {modifier}')
if __name__ == '__main__':
kv = """
BoxLayout:
orientation: 'vertical'
Label:
text: 'Test Text limit'
CharLimitTextInput:
id: input
max_characters: 64
hint_text: 'Enter up to 64 characters'
size_hint_y: None
height: dp(48)
Label:
text: input.text
"""
class TITestApp(App):
def build(self):
return Builder.load_string(kv)
TITestApp().run()
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71EoLfToOoapdcOheCk1-0kePMktNowYbgboO%2BZLxBNgzfg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5e665ef4.1c69fb81.8707e.50a2SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Do you need to used the Window.bind? Can you capture the key press of interest in the insert_test() method of the TextInput?
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71Er%3D7FB-7%2BvDvzETXGnTXrE-fAfFMxwrEB9DphM45oacyw%40mail.gmail.com.
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.textinput import TextInput
from kivy.properties import NumericProperty
from kivy.core.window import Window
class CharLimitTextInput(TextInput):
max_characters = NumericProperty(8) # sets the max number of chars the user can input
def __init__(self, **kwargs):
super().__init__(multiline=False, **kwargs) # Note: Multiline is False
def insert_text(self, substring, from_undo=False):
if len(self.text) < self.max_characters:
# old style, I'm not using Python 3.7
isascii = lambda s: len(s) == len(s.encode())
ss = substring if isascii(substring) else '' # Only accept ASCII Strings
return super().insert_text(ss, from_undo=from_undo)
def on_text_validate(self): # Runs when enter is pressed, because multiline is false
if len(self.text) >= self.max_characters:
self.text = self.text[0:self.max_characters]
return super().on_text_validate()
if __name__ == '__main__':
kv = """
BoxLayout:
orientation: 'vertical'
Label:
text: 'Test Text limit'
CharLimitTextInput:
id: input
max_characters: 64
hint_text: 'Enter up to 64 characters'
size_hint_y: None
height: dp(48)
Label:
text: input.text
Label:
id: echo_here
text: ""
"""To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/3a1d5a72-0f3c-4e67-a403-6dcccb3f5459%40googlegroups.com.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71Eo3WW9cbw3qXv-qrLpEjcH8EdwXWb4ysBHkn71UGtTyCg%40mail.gmail.com.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/1F3DA218-8E2F-4D9D-981F-9D8113CCAAC1%40cox.net.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71EoD7YT5eJSFqmP9O6ObXA%3DoQANW9i6zD10AaGci%3DmvGrQ%40mail.gmail.com.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5e66547c.1c69fb81.e0707.60f1SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71EoLfToOoapdcOheCk1-0kePMktNowYbgboO%2BZLxBNgzfg%40mail.gmail.com.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5e665ef4.1c69fb81.8707e.50a2SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71Er%3D7FB-7%2BvDvzETXGnTXrE-fAfFMxwrEB9DphM45oacyw%40mail.gmail.com.
CharLimitTextInput:
id: input
max_characters: 64
hint_text: 'Enter up to 64 characters'
size_hint_y: None
height: dp(48)
Label:
text: input.text
The id in a widget is a reference to the object. The CharLimitTextInput is names input. The input.text object is the text that is typed into the text box, it is also a kivy property. This means it will get updated automatically.
Did that make sense?
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/b4d6c982-9a5c-4b2c-8a29-7b41a4c19be1%40googlegroups.com.
id: echo_here To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/b4d6c982-9a5c-4b2c-8a29-7b41a4c19be1%40googlegroups.com.

Do you have a standalone kv file named titest.kv?
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/d7162cc1-8268-40f7-aae4-fe066a4cfbb3%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/d7162cc1-8268-40f7-aae4-fe066a4cfbb3%40googlegroups.com.
On Mar 9, 2020, at 7:30 PM, Robert Flatt <planckp...@gmail.com> wrote:
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/8f721320-1487-4ef0-a86e-d3b0d2fdb939%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/19D3CEA8-C061-43E9-9330-A83CEDF25F17%40cox.net.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/8f721320-1487-4ef0-a86e-d3b0d2fdb939%40googlegroups.com.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/19D3CEA8-C061-43E9-9330-A83CEDF25F17%40cox.net.
This was also working for me but the only problem is that on android when the app starts the keyboard automatically starts popping up.@Robert
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/8f721320-1487-4ef0-a86e-d3b0d2fdb939%40googlegroups.com.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/19D3CEA8-C061-43E9-9330-A83CEDF25F17%40cox.net.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/8f721320-1487-4ef0-a86e-d3b0d2fdb939%40googlegroups.com.
The image below is connect. It is the same thing I see.
Going back to the kv code…
BoxLayout:
orientation: 'vertical'
Label:
text: 'Test Text limit' # This is the Label above the text input.
CharLimitTextInput:
id: input
max_characters: 64
hint_text: 'Enter up to 64 characters'
size_hint_y: None
height: dp(48)
Label:
text: input.text # This is the Label that echoes the text input
Label:
id: echo_here # This is a blank label
text: ""
--
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/7473c67e-0602-42f6-912d-14cad992c2e4%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5e671747.1c69fb81.1d582.89d5SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
# Only accept ASCII Strings
&n
Window.bind(on_keyboard=self.android_back_click)
Window.bind(on_keyboard = self.keyboard)
):
if len(self.text) < <span style="font
def __init__(self,**kwargs): super(SecondWindow,self).__init__(**kwargs) self.screen_list=[] Window.bind(on_keyboard=self.android_back_click) Clock.schedule_once(lambda x: Window.release_all_keyboards(), 3)
The highlighted code seems to be a significant difference between the 2 files.
--
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/c738d75c-ef1a-4c7d-b45e-a121aa4ac45c%40googlegroups.com.
Clock.schedule_once(lambda x: Window.release_all_keyboards(), 3) #this is irrelevant hereTo view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5e671f2c.1c69fb81.6585a.2d22SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Another observation in ‘not working’ The indents are not correct here, looks like tabs. I wonder if this could be part of the problem.
class SecondWindow(Screen): def __init__(self,**kwargs): super(SecondWindow,self).__init__(**kwargs) self.screen_list=[] Window.bind(on_keyboard=self.android_back_click) Clock.schedule_once(lambda x: Window.release_all_keyboards(), 3) #Window.release_all_keyboards() def newcallback(self,text_of_selection,popup_widget): quit() def android_back_click(self,window,key,*largs): if key == 27: print(self.manager.current) if(self.manager.current=='main'): print('MAIN') quit() else: print('SECOND') self.manager.current='main' return TrueTo view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAHG71Eo1iSyG4hoM4qYHtAY94ptDk%2Bon4cU_zOJkTP6bXGd1zw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5e672460.1c69fb81.f078e.2ffcSMTPIN_ADDED_MISSING%40gmr-mx.google.com.