Reputation: 155
i am building a simple app that has several screens and i have been dealing with the android keyboard not hiding after the next screen is displayed. i have looked over the internet and have not found a solution that fixes this issue. below is a block of code that i found here. i have tried to modify it unsuccessfully. apparently i needed to import the android module for it to work but i'am not quite sure how to do it. please help if you have any idea how the hide the keyboard . Thanks
def hide_keyboard(f):
def new_function(self, *args, **kwargs):
try:
if platform == "android":
android.hide_keyboard()
self.root.from_n.focus = False
self.root.to_n.focus = False
except:
import traceback; traceback.print_exc();
f(self, *args, **kwargs)
return new_function
Upvotes: 6
Views: 1263
Reputation: 29488
Looks like Window has a method for this:
from kivy.core.window import Window
Window.release_all_keyboards()
Upvotes: 4