import sys import wx #------------------------------------------------------------------------------ class MainFrame( wx.Frame ) : """ Input values of 2 wx.TextCtrl_s. """ def __init__( self, parent, id, title, initialValues=(0, 0) ) : wid_initValue = initialValues[0] hgt_initValue = initialValues[1] wx.Frame.__init__ ( self,parent, wx.NewId(), title, size=(400, 300), pos=(100, 0), style=wx.DEFAULT_FRAME_STYLE ) self.SetBackgroundColour( (255, 250, 240) ) # "self"'s client background color allCtrls_horzSizer = wx.BoxSizer( wx.HORIZONTAL ) allCtrls_horzSizer.AddSpacer( 15 ) width_stTxt = wx.StaticText( self, -1, 'X' ) width_stTxt.SetBackgroundColour( (200, 200, 200) ) allCtrls_horzSizer.Add( width_stTxt, proportion=0, flag=wx.ALIGN_CENTER | wx.ALL, border=5 ) self.txtWidth_txtCtrl = wx.TextCtrl( self, 1, str( wid_initValue ) ) allCtrls_horzSizer.Add( self.txtWidth_txtCtrl, proportion=1, flag=wx.ALIGN_CENTER ) height_stTxt = wx.StaticText( self, -1, 'Y' ) height_stTxt.SetBackgroundColour( (200, 200, 200) ) allCtrls_horzSizer.Add( height_stTxt, proportion=0, flag=wx.ALIGN_CENTER | wx.ALL, border=5 ) self.txtHeight_txtCtrl = wx.TextCtrl( self, 1, str( hgt_initValue ) ) allCtrls_horzSizer.Add( self.txtHeight_txtCtrl, proportion=1, flag=wx.ALIGN_CENTER ) allCtrls_horzSizer.AddSpacer( 15 ) self.SetSizer( allCtrls_horzSizer ) self.Show() #end __init #end MainFrame class #============================================================================== if __name__ == '__main__' : app = wx.PySimpleApp( redirect=False ) appFrame = MainFrame( None, -1, 'Simple Sizer Demo', initialValues=(16, 24) ) app.MainLoop() #end if