TextInput focus problem
See original GitHub issueThis is a copy of my post at Google Groups. Python 2.7.10 / kivy 1.9.0 In this code:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
from kivy.uix.textinput import TextInput
from kivy.lang import Builder
Builder.load_string('''
<Base>:
Button:
text: 'Press for Popup'
on_press: root.edit_text()
<TextInputX>
focus: True
''')
class Base(BoxLayout):
def __init__(self, **kwargs):
super(Base, self).__init__(**kwargs)
def edit_text(self, *args):
self.clear_widgets()
content = TextInputX()
# content.focus = True
popup = Popup(content=content)
popup.open()
class TextInputX(TextInput):
def __init__(self, **kwargs):
super(TextInputX, self).__init__(**kwargs)
# self.focus = True
class SampleApp(App):
def build(self):
return Base()
if __name__ == '__main__':
SampleApp().run()
when the popup with the TextInput opens, its impossible to type.
If you erase the “focus: True” from the kv part you can write, but you lose focus when the popup opens. If you uncomment either of the “content.focus = True” or “self.focus = True” from the py side, nothing happens. They act as “focus = False” And of course, if you put “focus: False” in the kv part, it works as expected (no focus).
So does anybody knows of a way to set the focus AND be able to type? TIA
Issue Analytics
- State:
- Created 8 years ago
- Comments:36 (25 by maintainers)
Top Results From Across the Web
React Native focus issue when having two TextInput elements
The issue is when pressing on one InputField , it's focusing on the input but the cursor stays on the previous focused InputField...
Read more >Text Input problem on Focus - Starling Forum
When TextInput is focused and content is scrolled to top by keyboard to show input field the zone is calcuated wrong, so the...
Read more >Having a problem with text input focus in android devices
Hi to all , I am having a problem with the text input. When the user click on the menu icon, the menu...
Read more >[Android] First TextInput focus automatically blurred #30162
I've a little problem with the TextInput of React-Native library on Android. When I want to focus an input for the 1st time,...
Read more >Focus on the Next TextInput when Next Keyboard Button is ...
When we trigger focus on a second input this causes a blur to fire on our First Name text input. This would cause...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@toniree There are many ways to solve this problem. The below, simplified code works in Kivy V2.
If you still have issues, rather than posting on an old ticket, please create a fresh ticket with all your version details, code and logs. Thanks
Setting unfocus_on_touch to False is your friend when dealing with TextInputs.