I only made an on and addition button with actual functions
#!/usr/bin/python
# gridsizer.py
import wx
app = wx.App()
class GridSizer(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(300, 250))
def On(self, event):
x=input("")
def add(self,event):
return x
y=input("")
print x + y
menubar = wx.MenuBar()
file = wx.Menu()
file.Append(0, '&Quit', 'Exit Calculator')
menubar.Append(file, '&File')
self.SetMenuBar(menubar)
sizer = wx.BoxSizer(wx.VERTICAL)
self.display = wx.TextCtrl(self, -1, '', style=wx.TE_RIGHT)
sizer.Add(self.display, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 4)
gs = wx.GridSizer(4, 4, 3, 3)
gs.AddMany([
(wx.Button(self, 3, '='), 0, wx.EXPAND),
self.Bind(wx.EVT_BUTTON, on, id=3),
(wx.Button(self, 2, '+'), 0, wx.EXPAND),
self.Bind(wx.EVT_BUTTON, self.add, id=2)
])
sizer.Add(gs, 1, wx.EXPAND)
self.SetSizer(sizer)
self.Centre()
self.Show(True)
app = wx.App()
GridSizer(None, -1, 'GridSizer')
app.MainLoop()
Basically I made a gridsizer for the buttons, then binded on and add to their buttons I was just running two buttons to check for functionality and, I get a self undefined on line 20 Help, please!
_________________
I'm new, don't eat me... please, PLEASE, AHHHH!