Hi,
I've a problem with wx.SpinCtrl
Here we go with my source code:
import wx
import traceback
class TextPage(wx.Fra me):
def __init__(self):
wx.Frame.__init __(self, None, -1, "")
box = wx.BoxSizer(wx. VERTICAL)
self.spin = wx.SpinCtrl(sel f, -1)
box.Add(self.sp in)
self.SetSizer(b ox)
wx.EVT_SPINCTRL (self, self.spin.GetId (), self.spinCtrlEv ent )
self.CenterOnSc reen()
def spinCtrlEvent(s elf, evt):
pass
print "ALL RIGHT"
if __name__ == "__main__":
app = wx.PySimpleApp( 0)
p = TextPage()
p.Show()
app.MainLoop()
Now, my problem is the increment/decrement of self.spin value.
The SpinCtrl object increment/decrement 1 unit at time.
I must increment/decrement "n" unit at time, ex: 5,10,15,20....
I've tried:
def __init__(self):
........
........
self.old_quanti ty = 0
def spinCtrlEvent(s elf, evt):
if ( evt.GetInt() > self.old_quanti ty ):
qta = self.old_quanti ty + 5
else:
qta = self.old_quanti ty - 5
self.old_quanti ty = qta
self.spin.SetVa lue( qta )
But here the process it goes in loop, because the SetValue SpinCtrl
method regenerates the EVT_SPINCTRL event
Any idea?
Thanks very much
I've a problem with wx.SpinCtrl
Here we go with my source code:
import wx
import traceback
class TextPage(wx.Fra me):
def __init__(self):
wx.Frame.__init __(self, None, -1, "")
box = wx.BoxSizer(wx. VERTICAL)
self.spin = wx.SpinCtrl(sel f, -1)
box.Add(self.sp in)
self.SetSizer(b ox)
wx.EVT_SPINCTRL (self, self.spin.GetId (), self.spinCtrlEv ent )
self.CenterOnSc reen()
def spinCtrlEvent(s elf, evt):
pass
print "ALL RIGHT"
if __name__ == "__main__":
app = wx.PySimpleApp( 0)
p = TextPage()
p.Show()
app.MainLoop()
Now, my problem is the increment/decrement of self.spin value.
The SpinCtrl object increment/decrement 1 unit at time.
I must increment/decrement "n" unit at time, ex: 5,10,15,20....
I've tried:
def __init__(self):
........
........
self.old_quanti ty = 0
def spinCtrlEvent(s elf, evt):
if ( evt.GetInt() > self.old_quanti ty ):
qta = self.old_quanti ty + 5
else:
qta = self.old_quanti ty - 5
self.old_quanti ty = qta
self.spin.SetVa lue( qta )
But here the process it goes in loop, because the SetValue SpinCtrl
method regenerates the EVT_SPINCTRL event
Any idea?
Thanks very much