Ejercicio84.py

Hacer una ventana que tenga los 8 widgets aprendidos hasta el momento.
widgets aprendidos hasta el momento: wx.Frame , wx.Panel , wx.Button , wx.StaticText , wx.TextCtrl , wx.MessageDialog , wx.ComboBox , wx.TextCtrl (con wx.TE_MULTILINE)


# -*- coding: UTF8 -*-

import wx

class App(wx.App):
    def OnInit(self):
        self.ventana = wx.Frame(parent = None, title = u'Alta de Alumnos', size = (400,450), pos = (180,190))
        panel = wx.Panel(self.ventana, -1)
        ingreso = wx.StaticText(panel, -1, u'Ingreso de alumnos: ', pos = (20,20))
        nombre_alumno = wx.StaticText(panel, -1, u'Nombre: ', pos = (20,50))
        self.cuadro_nombre = wx.TextCtrl(panel, -1, '', pos = (120 , 45), size = (150,-1))
        apellido_alumno = wx.StaticText(panel, -1, u'Apellido: ', pos = (20,80))
        self.cuadro_apellido = wx.TextCtrl(panel, -1, '', pos = (120,75), size = (150,-1))
        edad_alumno = wx.StaticText(panel, -1, u'Edad', pos = (20,110))
        self.cuadro_edad = wx.TextCtrl(panel, -1, '', pos = (120,105), size = (40,-1))
        dni = wx.StaticText(panel, -1, u'DNI: ', pos = (20,140))
        dni_alumno = [u'DNI', u'LE', u'LC', u'PAS', u'ET']
        self.desplegable_dni = wx.ComboBox(panel, -1, u'DNI', (120,135), (150,-1), dni_alumno, wx.CB_DROPDOWN | wx.CB_READONLY)
        num_dni = wx.StaticText(panel, -1, u'Numero: ', pos = (20, 170))
        self.cuadro_dni = wx.TextCtrl(panel, -1, '', pos = (120, 165), size = (150,-1))
        observaciones = wx.StaticText(panel, -1, u'Obs: ', pos = (20,230))
        cuadro_obs = wx.TextCtrl(panel, -1, '', pos = (120,225), size = (150,80), style = wx.TE_MULTILINE)
        nacionalidad = wx.StaticText(panel, -1, u'Nacionalidad: ', pos = (20, 340))
        paises = [u'Argentina', u'Brasil', u'Chile', u'Uruguay', u'Paraguay', u'Bolivia', u'Venezuela', u'Colombia']
        self.cuadro_nacionalidad = wx.ComboBox(panel, -1, '', (120,335), (150,-1), paises, wx.CB_DROPDOWN)
        boton_aceptar = wx.Button(panel, -1, u'Aceptar', pos = (300, 400))
        boton_cancelar = wx.Button(panel, -1, u'Cancelar', pos=(200,400))
        self.Bind(wx.EVT_BUTTON, self.OnSalir, boton_cancelar)
        self.Bind(wx.EVT_BUTTON, self.OnAceptar, boton_aceptar)
        self.ventana.Show()
        return True
        
    def OnSalir(self, evt):
            self.ventana.Close()
        
    def OnAceptar(self, evt):
            ingresonombre = self.cuadro_nombre.GetValue()
            ingresoapellido = self.cuadro_apellido.GetValue()
            ingresoedad = self.cuadro_edad.GetValue()
            ingresonacion = self.cuadro_nacionalidad.GetValue()
            ingresodni = self.desplegable_dni.GetValue()
            ingresonumdni = self.cuadro_dni.GetValue()
            dialogo = wx.MessageDialog(self.ventana, u'Los datos se han ingresado correctamente, %s %s. Usted tiene %s años de edad, su nacionalidad es %s y su %s es %s.' % (ingresonombre, ingresoapellido,ingresoedad, ingresonacion,ingresodni, ingresonumdni), u'Informacion', wx.OK | wx.ICON_INFORMATION)
            dialogo.ShowModal()
            dialogo.Destroy()
        
        
aplicacion = App()
aplicacion.MainLoop()
       

bloogg!!

Deja un comentario