I have implemented a number of megawidget counters, and I would like them to call a function when their values change. Is this possible?
So far, I have only been able to get the counters to call my function when I enter keystrokes in the entryfield (excluding the up and down arrow keys, which do nothing). Here's a snippet:
Expand|Select|Wrap|Line Numbers
- myCounter.component('entryfield').bind("<Key>",myFunc)
Expand|Select|Wrap|Line Numbers
- myCounter.component('uparrow').bind("<Button 1>",myFunc)
I also tried using entryfield_command, but that only handles <Enter> key events.
Expand|Select|Wrap|Line Numbers
- myCounter = Pmw.Counter(myFrame,
- datatype = {'counter': 'real'},
- entryfield_validate = {'validator': 'real', 'min': 0.0, 'max': 10.0},
- entryfield_value = 2.0,
- entryfield_command = myFunc,
- entry_justify = 'center',
- entry_width = 4,
- orient = 'vertical',
- increment = 0.1,
- labelpos = 'w',
- label_text = 'My text')
Thanks in advance for your help