Skip to content

Instantly share code, notes, and snippets.

@bniebuhr
Last active May 9, 2016 14:26
Show Gist options
  • Save bniebuhr/f37f5eeb046f8fd3e250ef98252209a0 to your computer and use it in GitHub Desktop.
Save bniebuhr/f37f5eeb046f8fd3e250ef98252209a0 to your computer and use it in GitHub Desktop.
Trying to test buttons of a GUI
import wx
class Form1(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
self.button =wx.Button(self, 10, "MULTIPLICA", wx.Point(20,10))
wx.EVT_BUTTON(self, 10, self.OnClick)
self.button =wx.Button(self, 20, "SOMA", wx.Point(20,100))
wx.EVT_BUTTON(self, 20, self.OnClick)
def OnClick(self, event):
if event.GetId()==10: #Run import
a = 10
b = 20
multiplica = a*b
print multiplica
if event.GetId()==20: #Run import
a = 10
b = 20
soma = a+b
print soma
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = wx.Frame(None, -1, "test GUI", pos=(0,0), size=(200,200))
Form1(frame,-1)
frame.Show(1)
app.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment