#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Sun Apr 22 23:38:24 2012
import wx
# begin wxGlade: extracode
# end wxGlade
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.z = wx.TextCtrl(self, -1, "")
self.y = wx.TextCtrl(self, -1, "")
self.x = wx.TextCtrl(self, -1, "")
self.button_1 = wx.Button(self, -1, "=")
self.a = wx.TextCtrl(self, -1, "")
self.button_2 = wx.Button(self, -1, "1")
self.button_3 = wx.Button(self, -1, "2")
self.button_4 = wx.Button(self, -1, "3")
self.button_5 = wx.Button(self, -1, "4")
self.button_6 = wx.Button(self, -1, "5")
self.button_7 = wx.Button(self, -1, "6")
self.button_8 = wx.Button(self, -1, "7")
self.button_9 = wx.Button(self, -1, "8")
self.button_10 = wx.Button(self, -1, "9")
self.button_11 = wx.Button(self, -1, "0")
self.button_12 = wx.Button(self, -1, ".")
self.button_13 = wx.Button(self, -1, "+")
self.button_14 = wx.Button(self, -1, "_")
self.button_15 = wx.Button(self, -1, "X")
self.button_16 = wx.Button(self, -1, "/")
self.button_17 = wx.Button(self, -1, "clr")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.equals, self.button_1)
self.Bind(wx.EVT_BUTTON, self.click1, self.button_2)
self.Bind(wx.EVT_BUTTON, self.click2, self.button_3)
self.Bind(wx.EVT_BUTTON, self.click3, self.button_4)
self.Bind(wx.EVT_BUTTON, self.click4, self.button_5)
self.Bind(wx.EVT_BUTTON, self.click5, self.button_6)
self.Bind(wx.EVT_BUTTON, self.click6, self.button_7)
self.Bind(wx.EVT_BUTTON, self.click7, self.button_8)
self.Bind(wx.EVT_BUTTON, self.click8, self.button_9)
self.Bind(wx.EVT_BUTTON, self.click9, self.button_10)
self.Bind(wx.EVT_BUTTON, self.click0, self.button_11)
self.Bind(wx.EVT_BUTTON, self.decimal, self.button_12)
self.Bind(wx.EVT_BUTTON, self.plus, self.button_13)
self.Bind(wx.EVT_BUTTON, self.minus, self.button_14)
self.Bind(wx.EVT_BUTTON, self.multi, self.button_15)
self.Bind(wx.EVT_BUTTON, self.div, self.button_16)
self.Bind(wx.EVT_BUTTON, self.clear, self.button_17)
# end wxGlade
def __set_properties(self):
# begin wxGlade: MyFrame.__set_properties
self.SetTitle("Calculator")
self.SetSize((460, 200))
self.SetBackgroundColour(wx.Colour(143, 194, 255))
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.FlexGridSizer(6, 6, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add(self.z, 0, 0, 0)
sizer_1.Add(self.y, 0, 0, 0)
sizer_1.Add(self.x, 0, 0, 0)
sizer_1.Add(self.button_1, 0, 0, 0)
sizer_1.Add(self.a, 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add(self.button_2, 0, 0, 0)
sizer_1.Add(self.button_3, 0, 0, 0)
sizer_1.Add(self.button_4, 0, 0, 0)
sizer_1.Add(self.button_5, 0, 0, 0)
sizer_1.Add(self.button_6, 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add(self.button_7, 0, 0, 0)
sizer_1.Add(self.button_8, 0, 0, 0)
sizer_1.Add(self.button_9, 0, 0, 0)
sizer_1.Add(self.button_10, 0, 0, 0)
sizer_1.Add(self.button_11, 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add(self.button_12, 0, 0, 0)
sizer_1.Add(self.button_13, 0, 0, 0)
sizer_1.Add(self.button_14, 0, 0, 0)
sizer_1.Add(self.button_15, 0, 0, 0)
sizer_1.Add(self.button_16, 0, 0, 0)
sizer_1.Add((20, 20), 0, 0, 0)
sizer_1.Add(self.button_17, 0, 0, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
def click1(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click1' not implemented"
v='1'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click2(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click2' not implemented!"
v='2'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click3(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click3' not implemented!"
v='3'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click4(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click4' not implemented!"
v='4'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click5(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click5' not implemented!"
v='5'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click6(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click6' not implemented!"
v='6'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click7(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click7' not implemented!"
v='7'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click8(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click8' not implemented!"
v='8'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click9(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click9' not implemented!"
v='9'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def click0(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `click0' not implemented!"
v='0'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def decimal(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `decimal' not implemented!"
v='.'
t=self.x.GetValue()
t=t+v
self.x.SetValue(t)
event.Skip()
def plus(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `plus' not implemented!"
c = float(self.x.GetValue())
self.z.SetValue(str(c))
self.y.SetValue('+')
self.x.SetValue('')
event.Skip()
def minus(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `minus' not implemented!"
c = float(self.x.GetValue())
self.z.SetValue(str(c))
self.y.SetValue('-')
self.x.SetValue('')
event.Skip()
def multi(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `multi' not implemented!"
c = float(self.x.GetValue())
self.z.SetValue(str(c))
self.y.SetValue('x')
self.x.SetValue('')
event.Skip()
def div(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `div' not implemented!"
c = float(self.x.GetValue())
self.z.SetValue(str(c))
self.y.SetValue('/')
self.x.SetValue('')
event.Skip()
def equals(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `equals' not implemented!"
c = float(self.x.GetValue())
d = float(self.z.GetValue())
e = self.y.GetValue()
if(e == '+' ):
ans=c+d
elif(e == 'x' ):
ans=c*d
elif(e == '-' ):
ans=d-c
else:
ans=d/c
self.a.SetValue(str(ans))
event.Skip()
def clear(self, event): # wxGlade: MyFrame.<event_handler>
#print "Event handler `clear' not implemented!"
self.x.SetValue('')
self.y.SetValue('')
self.z.SetValue('')
self.a.SetValue('')
event.Skip()
# end of class MyFrame
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
app.MainLoop()
IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCiMgLSotIGNvZGluZzogdXRmLTggLSotCiMgZ2VuZXJhdGVkIGJ5IHd4R2xhZGUgMC42LjMgb24gU3VuIEFwciAyMiAyMzozODoyNCAyMDEyCgppbXBvcnQgd3gKCiMgYmVnaW4gd3hHbGFkZT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