473,395 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

SpinCtrl events problem

Hi,

I've a problem with wx.SpinCtrl
Here we go with my source code:

import wx
import traceback

class TextPage(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "")

box = wx.BoxSizer(wx.VERTICAL)

self.spin = wx.SpinCtrl(self, -1)

box.Add(self.spin)

self.SetSizer(box)

wx.EVT_SPINCTRL(self, self.spin.GetId(), self.spinCtrlEvent )

self.CenterOnScreen()

def spinCtrlEvent(self, 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_quantity = 0

def spinCtrlEvent(self, evt):

if ( evt.GetInt() > self.old_quantity ):
qta = self.old_quantity + 5
else:
qta = self.old_quantity - 5

self.old_quantity = qta
self.spin.SetValue( qta )

But here the process it goes in loop, because the SetValue SpinCtrl
method regenerates the EVT_SPINCTRL event

Any idea?
Thanks very much

Jun 7 '06 #1
0 988

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steven Brown | last post by:
I'm trying to figure out how to safely use .NET events/delegates in a thread-safe class. There are a couple problems. One is that the standard "if(EventName != null) EventName(...);" call can...
5
by: knocte | last post by:
Hello. I am a web developer very worried about "bloat code" and "languages mixture". So, since some time, I always try to avoid completely the use of javascript in XHTML/HTML files. This leads...
2
by: Jon Davis | last post by:
The garbage handler in the .NET framework is handy. When objects fall out of scope, they are automatically destroyed, and the programmer doesn't have to worry about deallocating the memory space...
0
by: Efim | last post by:
Hi, I have got some problem with sending of events in .NET. I am using remouting. The client has got 2 objects for receiving different types of events (responses and events) The server has got...
2
by: glenn | last post by:
I have a very serious problem with my forms and components that I was wondering if there was a way to turn off. The problem is as follows: 1) create a form and place 50 components on the form...
2
by: dave | last post by:
Hi, I have a COM control / server I'm trying to get events from in my c# applications. 1) I'm trying to get events in both c# console apps and in c# winform apps. 2) I can call methods on the...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
30
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment...
3
by: blackno666 | last post by:
Hello, I am new to Python/wxPython and am experiencing first problems. I have a dialog which includes a SpinCtrl and a Slider. I want the Slider to affect the SpinCtrl and vice versa...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.