Cody Precord wrote:
Hello,
Hi,
I am trying to remove the caption from my frame, but it keeps
causing the children widgets to not render correctly. Here is what
I am doing:
<code>
wx.Frame.__init__(self, None, wx.ID_ANY, size=(100,100),
style=wx.SYSTEM_MENU >wx.FRAME_NO_TASKBAR)
panel = wx.Panel(self, wx.ID_ANY)
self.statBtn = wx.Button(panel, wx.ID_ANY, "Show")
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.statBtn, 1, wx.CENTER|wx.EXPAND, 5)
panel.SetSizer(sizer)
</code>
This makes a dark grey box with part of my button visible in the
upper left corner. I tried Refresh(), Update() and Layout() on the
frame object and it has no effect. I'm pretty sure this is
something silly, but I'm just not seeing it. Your help would be
appreciated.
Did you try putting the Panel in a sizer and setting that sizer as the Frames?
msizer = wx.BoxSizer(wx.VERTICAL)
msizer.Add(panel, 1, wx.EXPAND)
self.SetSizer(msizer)
I tried that right after I sent the email, but no dice. Here's a small runnable sample:
<code>
import wx
class DockedFrame(wx.Frame): def __init__(self):
"""
Initialize the frame
"""
wx.Frame.__init__(self, None, wx.ID_ANY, size=(100,100),
style=wx.SYSTEM_MENU
>wx.FRAME_NO_TASKBAR)
panel = wx.Panel(self, wx.ID_ANY)
self.statBtn = wx.Button(panel, wx.ID_ANY, "Show")
msizer = wx.BoxSizer(wx.VERTICAL)
msizer.Add(panel, 1, wx.EXPAND)
self.SetSizer(msizer)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.statBtn, 1, wx.CENTER|wx.EXPAND, 5)
panel.SetSizer(sizer)
width, height = wx.DisplaySize()
x = width - 150
y = height - 150 self.SetPosition((x, y))
self.Show()
class StatusController(wx.App): def __init__(self, redirect=False, filename=None):
"""
Initialize the application and instantiate the frame
"""
wx.App.__init__(self, redirect, filename)
frame = DockedFrame()
···
On Fri, Mar 20, 2009 at 1:48 PM, Mike Driscoll <mike@pythonlibrary.org > <mailto:mike@pythonlibrary.org>> wrote:
#-------------------------------------------------------------
# Run program
if __name__ == "__main__":
app = StatusController()
app.MainLoop()
</code>
I found that if I call panel.Fit(), the entire button will appear, albeit still stuck in the upper left corner with the rest being dark gray.
Mike