Ver Mensaje Individual
  #8 (permalink)  
Antiguo 27/05/2011, 14:51
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 1 mes
Puntos: 1360
Respuesta: wxpython y base de datos asesoria porfavor

Por cierto al menos separa tu código en clases.
Código Python:
Ver original
  1. import wx
  2.  
  3. class MyFrame(wx.Frame):
  4.     def __init__(self, *args, **kwargs):
  5.         wx.Frame.__init__(self, *args, **kwargs)
  6.         MyPanel(self)
  7.        
  8. class MyPanel(wx.Panel):
  9.     def __init__(self, *args, **kwargs):
  10.         wx.Panel.__init__(self, *args, **kwargs)
  11.        
  12.         datos = wx.StaticText(self, -1, u'Datos Personales: ', pos = (200,0))
  13.         nombre = wx.StaticText(self, -1, u'Nombre: ', pos = (20,20))
  14.         cuadro_nombre = wx.TextCtrl(self, -1, '', pos = (90 , 20), size = (150,-1))
  15.         apellido = wx.StaticText(self, -1, u'Apellido: ', pos = (20,50))
  16.         self.cuadro_apellido = wx.TextCtrl(self, -1, '', pos = (90, 50), size = (150,-1))
  17.         sexo = wx.StaticText(self, -1, u'Sexo: ', pos = (20, 80))
  18.         sexolista = [u'F', u'M']
  19.         cuadro_sexo = wx.ComboBox(self, -1, '', (90 , 80), (150,-1), sexolista, wx.CB_DROPDOWN)
  20.         cedula = wx.StaticText(self, -1, u'Cedúla: ', pos = (20,110))
  21.         cuadro_cedula = wx.TextCtrl(self, -1, '', pos = (90 , 110), size = (150,-1))
  22.         telefono = wx.StaticText(self, -1, u'Telefono: ', pos = (20,140))
  23.         cuadro_telefono = wx.TextCtrl(self, -1, '', pos = (90 , 140), size = (150,-1))
  24.         celular = wx.StaticText(self, -1, u'Núm Celular: ', pos = (20,170))
  25.         cuadro_celular = wx.TextCtrl(self, -1, '', pos = (90 , 170), size = (150,-1))
  26.         direccion = wx.StaticText(self, -1, u'Dirección: ', pos = (20,200))
  27.         cuadro_direccion = wx.TextCtrl(self, -1, '', pos = (90, 200), size = (150,80), style = wx.TE_MULTILINE)
  28.         edad = wx.StaticText (self, -1, u'Edad: ', pos = (300,20))
  29.         cuadro_edad = wx.SpinCtrl(self, -1, pos = (340,20))
  30.         cuadro_edad.SetRange(0,110)
  31.         fecha_nacimiento = wx.StaticText(self, -1, u'Fecha de N.: ', pos = (300,50))
  32.         cuadro_fnacimiento = wx.DatePickerCtrl(self, -1, pos = (380,50), size = (150,-1))
  33.         boton_aceptar = wx.Button(self, -1, u'Guardar Datos', pos = (200,300))
  34.         boton_cerrar = wx.Button(self, -1, u'Cerrar', pos = (330,300))
  35.        
  36.         boton_cerrar.Bind(wx.EVT_BUTTON, self.OnSalir)
  37.         boton_aceptar.Bind(wx.EVT_BUTTON, self.OnGuardar)
  38.        
  39.     def OnSalir(self, evt):
  40.         self.Parent.Close()
  41.    
  42.     def OnGuardar(self, evt):
  43.         ingresoapellido = self.cuadro_apellido.GetValue()
  44.         dialogo = wx.MessageDialog(self, u'Estimado/a %s, sus datos fueron guardados' % (ingresoapellido), u'Información', wx.OK | wx.ICON_INFORMATION)
  45.         dialogo.ShowModal()
  46.         dialogo.Destroy()
  47.        
  48. class App(wx.App):
  49.     def OnInit(self):
  50.         f = MyFrame(parent = None, title = u'Censo de Personas Consejo Comunal', size = (600,400), pos = (320,150))
  51.         f.Show()
  52.         return True
  53.  
  54. aplicacion = App(0)
  55. aplicacion.MainLoop()