1

I wrote an application in tkinter which I want to run in fullscreen size for aesthetic reasons. And with fullscreen I mean full (!) fullscreen. I use the virtual keyboard "florence" as keyboard.

I saw this post where someone found a solution for automatically show the keyboard when you click on an tkinter-entry-widget.

I implemented this function in my code and it works as long as fullscreen-mode is not activated.

Problem: The florence keyboard is shown but not on very top but behind my fullscreen-tkinter-app.

I checked the settings of the keyboard, the error still exists even when the florence-settings "keep on top" and "always on top" are active.

This is a basic tkinter example code, which produces the "error":

from tkinter import*
import subprocess

root = Tk()

def toggleKeyboard(entry_widget_1):
    p = subprocess.Popen(['florence show'], shell=True, stdout= subprocess.PIPE, stderr= subprocess.PIPE, universal_newlines=True)
    if not "" == p.stderr.readline():
        subprocess.Popen(['florence'], shell=True)

# example entry widget 1
entry_widget_1 = Entry(root)
entry_widget_1.pack()

# example entry widget 2
entry_widget_2 = Entry(root)
entry_widget_2.pack()

# bind toggleKeyboard function to entry-widget 1 to open florence
entry_widget_1.bind('<FocusIn>',toggleKeyboard)

# allow user to close app via escape button
def close(event):
    root.destroy()

root.bind('<Escape>',close)

# resize app to full(!)-fullscreen
root.attributes("-fullscreen",True)

root.mainloop()
Johannes Wiesner
  • 1,006
  • 12
  • 33
  • This is a long-shot but based on [this](https://stackoverflow.com/questions/1892339/how-to-make-a-tkinter-window-jump-to-the-front) have you tried `tkinter.WIDGET.lower()` or `tkinter.WIDGET.attributes("-topmost", False)`? – Nae Nov 12 '17 at 22:22
  • Good thought but unfortunately both doesn't work. By the way I don't necessarily have to use the florence-keyboard. Any other virtual keyboard is also fine for me. So if this problem is solvable by simply using a different keyboard that's also fine. – Johannes Wiesner Nov 13 '17 at 08:04
  • What desktop environment do you use? I tried your code on my laptop with XFCE and the keyboard did show up on top of the fullscreen app. – j_4321 Nov 13 '17 at 09:48
  • I bought the rp3 a few days ago and it came with a preinstalled raspian image on the sd-card. So I guess I am using PIXEL? Any hints how to find out the current desktop environment on rp3 are much appreciated – Johannes Wiesner Nov 13 '17 at 10:13
  • When I type $DESKTOP_SESSION in terminal it returns LXDE-pi – Johannes Wiesner Nov 13 '17 at 10:33
  • So yes, I am using PIXEL – Johannes Wiesner Nov 13 '17 at 13:16
  • So I think the problem is not directly due to tkinter but comes from the way the window manager used by PIXEL manages fullscreen. I have neither a raspberry pi, nor PIXEL installed, so I cannot help you to find a workaround, sorry. – j_4321 Nov 13 '17 at 16:07
  • @j_4321 Yeah I really hoped that this wouldn't be the answer but I am beginning to lose hope for a different solution...Thank you anyway for running the code on your computer! I guess I'll just write a tkinter-virtual keyboard on my own because I definitely don't want to use a different desktop environment only for this single purpose. By the way: I am getting the same error with the "matchbox-keyboard", which also supports your hypothesis. – Johannes Wiesner Nov 14 '17 at 10:48
  • Maybe you could fill in a bug report about this issue. – j_4321 Nov 14 '17 at 10:58

0 Answers0