tiny window and a static label not showing

Hello all:
I'm working on a client app using wxPython, and my window is working kind of weird. I"m just using what I call snap in panels--when something changes I just change the panel. Any ideas as to why the window shows up really small would be appreciated, as well as any tips for how I could do this better.
Here's my code:
#main.py
import wx
from twisted.internet import wxreactor
from twisted.internet import reactor
from window import *
from factory import cfactory
import forms

def main():
   print "in main"
   app = wx.App()
   mframe = MainFrame(None, -1, "Alpine Games Client", wx.DefaultPosition, wx.Size(500, 400))
   mframe.Show(True)
   mframe.Center()
   mframe.Maximize()
   app.frame = mframe
   mframe.app = app
   panel = forms.LoginFrame(mframe)
   mframe.SetPanel(panel)
   app.SetTopWindow(mframe)
   app.MainLoop()

if __name__ == '__main__':
   main()
#window.py
"""
This is Alpine's main window.
"""
import wx

class MainFrame(wx.Frame):
   def __init__(self, *args, **kwargs):
     super(MainFrame, self).__init__(*args, **kwargs)
     self.CreateUI()
   def CreateUI(self):
     return
   def SetPanel(self, panel):
     self.panel = panel
     self.panel.app = self.app
     self.panel.Show()
     self.Center()
     self.SetMinClientSize(self.panel.GetBestSize())
     #forms/login.py
import wx

class LoginFrame(wx.Panel):
   def __init__(self, parent):
     super(LoginFrame, self).__init__(parent)
     sizer = wx.BoxSizer(wx.HORIZONTAL)
     tsizer = wx.BoxSizer(wx.VERTICAL)
     bsizer = wx.BoxSizer(wx.HORIZONTAL)
     self.radiooptions = wx.RadioBox(self, -1, "Login as", choices=['Login as another user'])
     self.radiooptions.SetFocus()
     sizer.Add(self.radiooptions)
     self.name = wx.TextCtrl(self, wx.ID_ANY)
     tsizer.Add(wx.StaticText(self, -1, "User name"))
     tsizer.Add(self.name)
     tsizer.Add(wx.StaticText(self, -1, "Password"))
     self.password = wx.TextCtrl(self, wx.ID_ANY)
     tsizer.Add(self.password)
     self.ok = wx.Button(self, wx.ID_OK)
     bsizer.Add(self.ok)
     tsizer.Add(bsizer)
     sizer.Add(tsizer)
     self.SetSizer(sizer)

···

--

Take care,
Ty
Web: http://tds-solutions.net
The Aspen project: a light-weight barebones mud engine
http://code.google.com/p/aspenmud

Sent from my toaster.

Sizer layout and other layout related things are done automatically in the EVT_SIZE event handlers. However since you maximize your frame first and then add the panel, there will be no EVT_SIZE event after the panel is created, so the default behavior of the frame resizing its only child to fill the client area will not happen. For situations like this you need to tickle the layout mechanism a little. If the frame was using a sizer then calling self.Layout() would do it, however in this case you probably just want to use self.SendSizeEvent().

···

On 1/28/12 7:46 AM, Littlefield, Tyler wrote:

Hello all:
I'm working on a client app using wxPython, and my window is working
kind of weird. I"m just using what I call snap in panels--when something
changes I just change the panel. Any ideas as to why the window shows up
really small would be appreciated, as well as any tips for how I could
do this better.

--
Robin Dunn
Software Craftsman