#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.4 on Tue Mar 5 20:17:11 2013
import wx
# begin wxGlade: extracode
# end wxGlade
class Calculadora(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: Calculadora.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.label_primero = wx.StaticText(self, -1, u"Primer Número")
self.text_ctrl_primero = wx.TextCtrl(self, -1, "")
self.label_segundo = wx.StaticText(self, -1, u"Segundo Número")
self.text_ctrl_segundo = wx.TextCtrl(self, -1, "")
self.label_respuesta = wx.StaticText(self, -1, "Resultado")
self.text_ctrl_respuesta = wx.TextCtrl(self, -1, "")
self.button_suma = wx.Button(self, -1, "Sumar")
self.button_salir = wx.Button(self, -1, "Salir")
self.button_ayuda = wx.Button(self, -1, "Ayuda")
self.button_info = wx.Button(self, -1, "Info")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.OnSuma, self.button_suma)
self.Bind(wx.EVT_BUTTON, self.OnSalir, self.button_salir)
self.Bind(wx.EVT_BUTTON, self.OnAyuda, self.button_ayuda)
self.Bind(wx.EVT_BUTTON, self.OnInfo, self.button_info)
# end wxGlade
def __set_properties(self):
# begin wxGlade: Calculadora.__set_properties
self.SetTitle("Calculadora")
self.text_ctrl_primero.SetMinSize((200, 27))
self.text_ctrl_segundo.SetMinSize((200, 27))
self.text_ctrl_respuesta.SetMinSize((200, 27))
# end wxGlade
def __do_layout(self):
# begin wxGlade: Calculadora.__do_layout
vsizer = wx.BoxSizer(wx.VERTICAL)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
grid_sizer = wx.GridSizer(3, 2, 0, 0)
grid_sizer.Add(self.label_primero, 0, wx.ALIGN_RIGHT, 0)
grid_sizer.Add(self.text_ctrl_primero, 0, 0, 0)
grid_sizer.Add(self.label_segundo, 0, wx.ALIGN_RIGHT, 0)
grid_sizer.Add(self.text_ctrl_segundo, 0, 0, 0)
grid_sizer.Add(self.label_respuesta, 0, wx.ALIGN_RIGHT, 0)
grid_sizer.Add(self.text_ctrl_respuesta, 0, 0, 0)
vsizer.Add(grid_sizer, 0, wx.EXPAND, 0)
hsizer.Add(self.button_suma, 0, 0, 0)
hsizer.Add(self.button_salir, 0, 0, 0)
hsizer.Add(self.button_ayuda, 0, 0, 0)
hsizer.Add(self.button_info, 0, 0, 0)
vsizer.Add(hsizer, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.SetSizer(vsizer)
vsizer.Fit(self)
self.Layout()
# end wxGlade
def OnSuma(self, event): # wxGlade: Calculadora.<event_handler>
a = int(self.text_ctrl_primero.GetValue())
b = int(self.text_ctrl_segundo.GetValue())
c = str(a + b)
self.text_ctrl_respuesta.SetValue(c)
def OnSalir(self, event): # wxGlade: Calculadora.<event_handler>
self.Destroy()
def OnAyuda(self, event): # wxGlade: Calculadora.<event_handler>
wx.MessageBox('Introduzca a,b,c respectivamente y presione calcular para obtener las dos soluciones')
def OnInfo(self, event): # wxGlade: Calculadora.<event_handler>
wx.MessageBox('Autor: FGUM\nFecha de creacion: 03/03/13')
# end of class Calculadora
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame = Calculadora(None, -1, "")
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()