0

I have a Tkinter script running in fullscreen mode. I have a function which calls the matchbox-keyboard command using the subprocess module when clicked on an input field. This works fine, but the problem is that the keyboard opens behind the Tkinter window.

Is there any way to make the keyboard appear on top, maybe some configuration flags when calling the matchbox-keyboard command, or some setting in the Raspberry Pi?

I am using Python 3.4 and the target Raspbian OS is Jesse.

3

Try adding the following section to /etc/xdg/openbox/lxde-pi-rc.xml, or whatever config file you are using, inside the <applications> section:

<application title="Keyboard">
    <layer>above</layer>
</application>

Also note that matchbox-keyboard supports embedding using XReparentWindow(), though I don't use Python much and have no idea which package you could use which provides the necessary bindings for Xlib. A quick google search suggests python-xlib may do this.

There are additional solutions discussed in this SO question, using either XRaiseWindow() call or _NET_WM_STATE_ABOVE WM hint.

PS. I just tried it on my Pi. _NET_WM_STATE_ABOVE doesn't seem to work. Editing the openbox rc file works fine though.

5
  • 1
    I tried this, but it didn't work. I found a bunch of XML files in /usr/share/matchbox-keyboard/ . Is there something I can do here?
    – RishiC
    Sep 23 at 8:45
  • @RishiC Yes, you can change the keyboard layout there :) If you want the keyboard to be on the top layer, you need to configure the window manager. Check that you use openbox, and find out which config file is really used. Sep 23 at 9:07
  • @RishiC My bad, you have to replace name with title in the config file. Sep 24 at 11:33
  • 1
    This didn't work either. I guess I'm not editing the correct config file. I will look into it more and give an update if I manage to figure it out
    – RishiC
    Sep 26 at 16:20
  • @RishiC Yeah I'm on Buster and it's entirely possible that Jesse uses a different config file. Try running ps ax | grep openbox, maybe there's a config file specified on the command line. Or list all xml files with find /etc /home | grep rc.xml and try editing these. Sep 27 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.