Hi
im new to wxpython and im trying to make a simpel counter. (a static text that you can chance with a plus and a minus button). Here is what i have done so far.
import wx
class my_frame(wx.Frame):
def init(self):
t1 = 0
t2 = 0
t3 = 0
#Make frame
wx.Frame.init(self, None, style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX, title=‘Diablo 3 Counter’, size=(200, 190))
panel = wx.Panel(self)
#Make text
self.st1 = wx.StaticText(panel,pos=(60,10), size=(80, 40))
self.st1.SetFont(wx.Font(24, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, u’Consolas’))
self.st1.SetLabel(‘0’)
#Make minus button
self.m1 = wx.Button(panel, label=’-’, pos=(10,10), size=(40, 40))
self.m1.SetFont(wx.Font(24, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, u’Consolas’))
self.m1.Bind(wx.EVT_BUTTON, self.mClick(self.st1))
#Make plus button
self.p1 = wx.Button(panel, label=’+’, pos=(150,10), size=(40, 40))
self.p1.SetFont(wx.Font(24, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, u’Consolas’))
self.p1.Bind(wx.EVT_BUTTON, self.pClick(self.st1))
self.Show()
def mClick(self, st):
t = int(st.GetLabel())
st.SetLabel(str(t-1))
def pClick(self, st):
t = int(st.GetLabel())
st.SetLabel(str(t+1))
app = wx.App()
my_frame()
app.MainLoop()
When i run the program it seems to run the pClick and mClick once and then nothing works
Hope someone can help