Hi,
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:
I would like the function to also be called when I click the uparrow and downarrow objects. However, if I do:
then the uparrow loses its normal operation (I can put myCounter.incre ment() in myFunc, but when I click and hold the button, the counter only increments once, unlike the normal PMW counter behavior)
I also tried using entryfield_comm and, but that only handles <Enter> key events.
So, is there a way for the PMW counter to call a function when its value changes?
Thanks in advance for your help
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:
Code:
myCounter.component('entryfield').bind("<Key>",myFunc)
Code:
myCounter.component('uparrow').bind("<Button 1>",myFunc)
I also tried using entryfield_comm and, but that only handles <Enter> key events.
Code:
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
Comment