全屏Python TKinter或wxPython窗口,但是“停留在所有窗口的底部”?

我想创build一个全屏面板,可视化地阻止访问屏幕上的所有内容(Ubuntu(11.10)中的桌面,菜单,Unity面板等),但是保持在其他应用程序打开的窗口下面。

这主要是为了让笔记本电脑的孩子certificate。 我想让孩子(4岁)有权访问一些选定的应用程序,即。 gcompris,儿童游戏,礼服math等,但不是真正的其他应用程序和设置。 像自定义桌面+启动面板没有什么可以打破,没有访问文件等

我希望面板包含一些可以启动其他应用程序的button(使用subprocess.call),但面板本身需要保留在启动的任何东西下,或者让事情更简单,只要它保持在任何打开的全屏游戏和每个打开的窗口(即使面板重点)。

Python的tkinter的全屏覆盖redirect(True)将是完美的(密码保护closuresbutton),如果不是它不允许其他应用程序出现在它上面,我不知道是否有可能使它停留在底部一切。

任何想法如果可能,如何改变这种行为,或任何其他工具,使我可以做到这一点在Python或其他?

编辑:其他信息:

我已经接近工作,但另一个奇怪的行为与overrideredirect(真)。 我可以在开始时降低()应用程序,但是当我使用overrideredirect(True)时,应用程序完全消失。 下面的非全屏testing代码:

from tkinter import * def btn1_click():app.quit();app.destroy() def btn2_click():app.lower() def handler(): if tkinter.messagebox.askyesno("Quit?", "Are you sure you want to quit?"): app.quit();app.destroy() app = Tk() app.title("Testing...") app.geometry('300x100+200+100') #app.overrideredirect(True) #app.lower() b1 = Button(app, text = "Exit!", width = 10, command = btn1_click);b1.pack() b2 = Button(app, text = "Lower", width = 10, command = btn2_click);b2.pack() app.protocol("WM_DELETE_WINDOW", handler) app.mainloop() 

当你运行它,它会打开新窗口,按“下”button将发送到后面,但如果您取消注释app.overrideredirect(True)行,并按下button,应用程序仍然会运行,但不会更长时间可见。

编辑…好吧,我想我明白了:

 >>>help(tkinter) ... | overrideredirect = wm_overrideredirect(self, boolean=None) | Instruct the window manager to ignore this widget | if BOOLEAN is given with 1. Return the current value if None | is given. ... 

所以,首先我要求窗口pipe理器忽略我的窗口,但后来我仍然希望WM能够对我的窗口做些什么… hypcracy 🙂

任何其他方式来剥离窗口装饰而不要求WM忽略窗口?

编辑。 另外看一下不同的工具 – wxPython的问题

这一次,我正在尝试简单的方法 – 使用Boa构造函数。 虽然window.frame上的app.lower()可以和Tkinter一起工作,但由于某种原因,我现在有一个wxPython的问题。 在下面的代码中 – 按下button在框架上打开一个gedit窗口,超过2秒后框架被带到顶部,另外2秒钟后它应该落在窗口堆栈的底部,但是至less没有发生,至less不在我的Ubuntu上。

 def OnButton3Button(self, event): subprocess.call("gedit") #opens gedit above the Frame time.sleep(2) #waits for 2 seconds self.Raise() #brings the Frame to the top time.sleep(2) #waits for another 2 seconds self.Lower() #should Lower the Frame to the bottom, but it doesn't 

如果我能使Lower()以某种方式工作,那么它很容易完成。

 def OnFrame1Activate(self, event): self.ShowFullScreen(True) def OnFrame1EnterWindow(self, event): self.Lower() 

现在我用尽了想法,可能我会坚持build议的访客帐户。

这是我如何设置窗口中的pygame的窗口位置。 有了它,它将覆盖所有其他的窗口,如果你将-1更改为1,它将在其他窗口的后面,我只知道它在窗口中工作。

 import pygame, time, datetime, ctypes from pygame.locals import * from ctypes import windll pygame.init() set_window_pos = windll.user32.SetWindowPos monitorsize = ctypes.windll.user32 resolution_X = monitorsize.GetSystemMetrics(0) resolution_Y = monitorsize.GetSystemMetrics(1) screen = pygame.display.set_mode((255, 242), pygame.NOFRAME) set_window_pos(pygame.display.get_wm_info()['window'], -1, (resolution_X - 255), 50, 0, 0, 0x0001) 

使窗口FULLSCREEN完成与:

 screen = pygame.display.set_mode((800, 350), FULLSCREEN) # this works in linux