我有一个tkinter.Toplevel
,它应该在所有其他应用程序中都是可见的。使用.wm_attributes("-topmost", True)
方法只能将窗口提升到所有其他窗口化应用程序之上,而不是全屏模式下的应用程序
如果在tkinter
内不可能,是否有任何库可以将窗口提升到所有其他应用程序之上
---编辑:添加代码----
import tkinter
class TransparentWindow(tkinter.Frame):
def __init__(self, master = None):
tkinter.Frame.__init__(self, master)
# Make the window transparent
transparent = self.set_transparent_color(
window = self.master,
color = "yellow"
)
self.master["bg"] = transparent
# Make the window fullscreen and non-resizable
self.master.state(
newstate = "zoomed"
)
self.master.resizable(
width = False,
height = False
)
# Test text label
test_label = tkinter.Label(
master = self.master,
text = "Test Text"
)
test_label.place(
relx = 0.9,
rely = 0.9
)
self.master.wm_attributes("-topmost", True)
def set_transparent_color(self, window, color):
"""
Mark a sacraficial color as transparent for a window.
"""
window.wm_attributes(
"-transparentcolor",
color
)
return color
# Create window
root_window = tkinter.Tk()
TransparentWindow(root_window)
root_window.mainloop()
目前没有回答
相关问题 更多 >
编程相关推荐