How to, guide, tutorial for keyboard or vkeyboard

2,803 views
Skip to first unread message

Travis Eddy

unread,
Oct 26, 2015, 1:40:52 PM10/26/15
to Kivy users support
 I'm having a hard time getting the keyboard ( touch screen to work)

all the examples that look like they have a keyboard ether crash or just don't work (kivy 1.9.1-dev, github download)  it looks like some of the examples are just old

the guides I've found around the internet assume to much. so I can't make them work.
from http://kivy.org/docs/api-kivy.uix.vkeyboard.html?highlight=keyboard#request-keyboard

Request Keyboard

The instantiation of the virtual keyboard is controlled by the configuration. Check keyboard_mode and keyboard_layout in the Configuration object.

If you intend to create a widget that requires a keyboard, do not use the virtual keyboard directly, but prefer to use the best method available on the platform. Check the request_keyboard() method in the Window.

If you want a specific layout when you request the keyboard, you should write something like this (from 1.8.0, numeric.json can be in the same directory as your main.py):

keyboard = Window.request_keyboard(
    self._keyboard_close, self)
if keyboard.widget:
    vkeyboard = self._keyboard.widget
    vkeyboard.layout = 'numeric.json'

can someone translate that to noob speak for someone who has just completed the Pong example. (whats a configuration object? how do i place that request on an object in the kivy .kv file? what is the numeric.json file, where is it, do i make it ? )


Is there another guide somewhere that is focused on getting an onscreen keyboard to work? and maybe has the full source on how to make a text box and then use the onscreen keyboard to fill it ???

Thanks


Travis Eddy

unread,
Oct 26, 2015, 3:14:25 PM10/26/15
to Kivy users support
Interesting update:

after my most recent PyCharm crash. a keyboard now pops up (docked no less) for the TextInput example in the showcase example.
I have no idea why, or why it wasn't there before. double checking on the rpi2 and going to redownload kivy from github...

also just addeding a
TextInput:

to the kivy file causes a floating keyboard to appear (and reappear if you click off and back on) sometimes "off screen" tho ( you'll see they top few pixels on the bottom of the screen)

ZenCODE

unread,
Oct 26, 2015, 4:01:44 PM10/26/15
to Kivy users support
Have you tried looking through or running this example?

https://github.com/kivy/kivy/tree/master/examples/keyboard

Travis Eddy

unread,
Oct 28, 2015, 3:17:00 PM10/28/15
to Kivy users support
@ZenCODE , yes but it crashed. So i didn't bother to look at the code.... but i'll take some time and look at it now.
Thanks :-)

Travis Eddy

unread,
Oct 28, 2015, 3:39:44 PM10/28/15
to Kivy users support
Trying to use/learn from/replicate the keyboard example leads to:

NameError: global name 'Window' is not defined

caused by:
kb
= Window.request_keyboard(self._keyboard_close, self)

or

keyboard = Window.request_keyboard(self._keyboard_close, self)



I tried on the a clean environment.
a TextInput box dose NOT cause a keyboard to pop up. so i'm going to have to force it some how.
tested on a windows laptop and raspberry pi 2


Is there any more docs any where about the kivy keyboard? other than the anemic page : http://kivy.org/docs/api-kivy.uix.vkeyboard.html

(also i'm trying to follow the 'best practices' and using a separate .kv file )

ZenCODE

unread,
Oct 28, 2015, 8:59:29 PM10/28/15
to Kivy users support
Are you sure you're importing the Window class? That sounds like a pretty standard import error....

    from kivy.core.window import Window

http://kivy.org/docs/api-kivy.core.window.html

Try posting a runnable example or your code. It's all guesswork otherwise.
Reply all
Reply to author
Forward
0 new messages