I’m working on Linux (Ubuntu 12.04). I have a full screen application running and want to show a floating frame above it. The frame shows just fine, but it also shows the desktop taskbar at the bottom of the screen, which I don’t want. (Xubuntu desktop).
I tried adding STAY_ON_TOP to both the main app frame and the floating frame with no effect. A standard dialog does not do this, only the MessageFrame class I wrote does this. It happens if I pass the main app frame as parent or None as parent, modal or not modal.
The relevant code:
def init(self, parent=None, title="", msg="", size=(250,50),
pad=(20,40), layout=None, modal=True):
“”"
Constructor.
“”"
bcolor = layout["colors"]["app_bcolor"]
fcolor = layout["colors"]["text_fcolor"]
font = layout["fonts"]["font14"]
# Get position info
if (parent != None):
self.parent = parent.GetTopLevelParent()
xy = parent.GetTopLevelParent().GetScreenPositionTuple()
sxy = parent.GetTopLevelParent().GetSizeTuple()
xy = (xy[0]+sxy[0]/2-size[0]/2, xy[1]+sxy[1]/2-size[1]/2)
if (xy[0] < 0):
xy = (0, xy[1])
if (xy[1] < 0):
xy = (xy[0], 0)
# Setup the frame
if (parent != None):
self.frame = wx.Frame(parent, -1, title, size=size, pos=xy, style=wx.RAISED_BORDER)
else:
self.frame = wx.Frame(parent, -1, title, size=size, style=wx.RAISED_BORDER)
if (modal):
self.frame.MakeModal(True)
# Put a panel on the frame
self.panel = wx.Panel(self.frame, -1)
self.panel.SetBackgroundColour(bcolor)
# Put the message on the panel
box = wx.BoxSizer(wx.HORIZONTAL)
self.msg = wx.StaticText(self.panel, -1, msg, style=wx.ALIGN_CENTER)
self.msg.SetFont(font)
self.msg.SetForegroundColour(fcolor)
box.Add(pad, 0)
box.Add(self.msg, 0, wx.ALIGN_CENTER)
box.Add(pad, 0)
self.panel.SetSizer(box)
box.Fit(self.frame)
# Show the frame
self.frame.Show()
self.frame.Refresh()
wx.GetApp().ProcessPendingEvents()
Does anyone know how to get this to always float over the without showing any of the underlying desktop?
Thanks!
Ron