I've spent forever looking for a solution to this. There are tons of posts on stackoverflow about this problem, which have gotten me this far and now I am stumped where to go next. I need to use the dock attribute on root because it needs to appear above all other windows, and without the bar at the top. The splash attribute almost works, but then other windows can pop up on top of it too when clicking on the screen where their borders are behind the app. For some reason the code below does not work on a raspberry pi, the simpledialog box appears behind the root application, so you cannot see it at all.
However, it works on my linux laptop. The only thing I could think of is that it is a window manager issue. From following the advice of more posts, I looked at the file "/etc/X11/default-display-manager", my raspberry pi is running default raspbian which utilizes the lightdm manager and my laptop uses gdm3. With some more research it seems raspberry pis can struggle to run gdm3. I tried downloading GNOME (which I think is gdm3) by running "sudo tasksel" in the command window and it still ran into the same problem. At this point I'm willing to try pretty much anything.
import tkinter as tk
from tkinter import simpledialog, messagebox
Root = tk.Tk()
Root.attributes('-type', 'dock')
width = Root.winfo_screenwidth()
height = Root.winfo_screenheight() - 30
Root.geometry("%dx%d+0+0" % (width, height))
button = tk.Button(Root, text="exit", command=Root.destroy).pack(pady=20)
Root.deiconify()
Root.lift()
Root.focus_force()
J = tk.simpledialog.askfloat("Input", "Number of points per scan:",parent=Root,minvalue=1000, maxvalue=7000)
Root.mainloop()
You are looking for the attribute
-topmost
witch just puts a window on top always (unless there are multiple windows ontopmost
), window manager have two kinds ofz-axis
, the layers overlap by level and the layer items overlap by focus history.