我正在尝试制作一个 wxpython 窗口(只是一个窗口,因为它是一个窗口对象).. 填充整个屏幕并且完全不可见。然后,我希望允许用户在“窗口”(即屏幕上的任何位置)内单击并拖动。
当我尝试进行self.SetTransparent(0)
用户输入时,窗口不会捕获。
这是预期的行为吗?
这是实现我想要的正确方法吗?人眼显然无法区分不透明度1
,但我仍然很好奇为什么我不能让它完全透明。
这是片段:
import wx
class Frame(wx.Frame):
def __init__(self):
style = (wx.STAY_ON_TOP | wx.NO_BORDER)
wx.Frame.__init__(self, None, title="Invisible", style=style)
self.SetTransparent(0) # This doesn't work
#self.SetTransparent(1) # But this works fine
self.Bind(wx.EVT_KEY_UP, self.OnKeyPress)
def OnKeyPress(self, event):
"""quit if user press q or Esc"""
if event.GetKeyCode() == 27 or event.GetKeyCode() == ord('Q'): #27 is Esc
self.Close(force=True)
else:
event.Skip()
app = wx.App()
frm = Frame()
frm.ShowFullScreen(True)
app.MainLoop()
或者有没有办法让窗口根本没有背景,而不是完全透明的彩色背景?