
import sys
import wx

#------------------------------------------------------------------------------

modules ={}     # ?

class SizeDialog( wx.Dialog ) :
    """ Custom dialog that provides values of 2 wx.TextCtrl_s. """

    def __init__( self, parent, id, title, defsize=(0, 0) ) :
    
        wx.Dialog.__init__( self, parent, id, title, size=(300, 120) )

        vbox = wx.BoxSizer( wx.VERTICAL )
        self.SetSizer( vbox )

        hbox = wx.BoxSizer( wx.HORIZONTAL )

        buttons = self.CreateButtonSizer( wx.OK|wx.CANCEL )

        self.txtWidth_tCtrl = wx.TextCtrl( self, -1, str( defsize[0] ) )
        label = wx.StaticText( self, -1, 'X' )
        self.txtHeight_tCtrl = wx.TextCtrl( self, -1, str( defsize[1] ) )

        hbox.Add( self.txtWidth_tCtrl, 1, wx.ALIGN_CENTER_VERTICAL )
        hbox.Add( label, 1, wx.ALIGN_CENTER_VERTICAL )
        hbox.Add( self.txtHeight_tCtrl, 1, wx.ALIGN_CENTER_VERTICAL )

        vbox.Add( hbox, 1, wx.LEFT|wx.RIGHT|wx.EXPAND|wx.TOP|wx.ALIGN_CENTER_HORIZONTAL, 10 )
        vbox.Add( buttons, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 10 )
        
    #end __init
    
    def GetWidth( self ) :
        return self.txtWidth_tCtrl.GetValue()
    #end def
    
    def GetHeight( self ) :
        return self.txtHeight_tCtrl.GetValue()
    #end def
    
#end SizeDialog class

#==============================================================================
        
if __name__ == '__main__' :

    app = wx.PySimpleApp()
    
    dlg = SizeDialog( None, -1, 'test', (16, 24) )
    rId = dlg.ShowModal()
    
    if rId == wx.ID_OK :
        print '\n----  You pressed "OK"   Size : {0}x{1}: ', dlg.GetWidth(), dlg.GetHeight()
        
    elif rId == wx.ID_CANCEL :
        print '\n----  You pressed "Cancel"'
        
    else :
        print '\n----  You pressed "X" to close the dialog'
        print rId
        
    #end if
    
    dlg.Destroy()
    app.MainLoop()
    
    sys.exit(1)     # Keep the MSW shell window open so I can read the print outputs.
    
#end if
