[wxPython-users] Basic frame-sizing problem

Christopher Barker Chris.Barker at noaa.gov
Mon Oct 23 10:08:38 PDT 2006


Bob Klahn wrote:
> Ah, I see now.  My supposed size parameter in my wx.Frame.__Init__ 
> invocation was actually the position parameter.

This is a great reason to use one of Python's fabulous features: keyword 
arguments and *args, **kwargs:

class TestFrame(wx.Frame):
   def __init__(self, *args, **kwargs):
     wx.Frame.__init__(self, *args, **kwargs)

class App(wx.App):
   def OnInit(self):

     x = wx.SystemSettings_GetMetric(wx.SYS_SCREEN_X)
     y = wx.SystemSettings_GetMetric(wx.SYS_SCREEN_Y)

     frame = TestFrame(None, title="Test Frame", size=(.9*x,.9*y))
     frame.Center(wx.BOTH)
     frame.Show(True)
     self.SetTopWindow(frame)
     return True

if __name__ == '__main__':
   app = App(0)
   app.MainLoop()




-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list