simon> Well, this is straight forward in pygtk1.2:
>>>> hscale.get_adjustment().connect("value_changed",value_changed_fn)
simon> with something like:
>>>> def value_changed_fn(adjustment):
simon> Does pygtk2 do it differently?
That wasn't quite what I was asking. I know how to connect to existing
signals. My apologies if my request misled anyone. Let me make it more
concrete. I want to create a compound widget that consists of a GtkTable,
three labels (red, green, blue) and an HScale for each color. Furthermore,
I'd like to define a new signal for the subclass, let's call it
"color-changed". My compound widget would connect to the "value-changed"
signals from each of the HScales, update its notion of the current color
(perhaps by converting to a "#XXXXXX"-style string), then emit
"color-changed", so code that is interested can notice when any of the
HScales changes value without me having to expose them directly. The
question is, can I do that from PyGtk2? I've never used PyGtk1.2, but I was
under the impression that you couldn't do what I want there.
To make things even more concrete, here's a skeleton:
class ColorScale(gtk.GtkTable):
def __init__(self, *args):
gtk.GtkTable.__init__(self, *args)
self.red = gtk.GtkHScale()
self.green = gtk.GtkHScale()
self.blue = gtk.GtkHScale()
self.attach_defaults(self.red, ...)
self.attach_defaults(self.green, ...)
self.attach_defaults(self.blue, ...)
# connect emit_color_changed to HScale "value-changed" signals
def emit_color_changed(self, ...):
self.emit("color-changed", ...)
... do the signal dance ...
At "do the signal dance" I would like to define the "color-changed" signal
for my new class.
Skip
simon> [EMAIL PROTECTED] wrote:
>> Suppose I have a color editor widget composed of a container and
>> three HScale widgets. Can I create a "value-changed" signal using
>> PyGtk2 that will be emitted when any of the HScale widgets changes?
>> If so, how?
>>
>> Thx,
>>
simon> _______________________________________________
simon> pygtk mailing list [EMAIL PROTECTED]
simon> http://www.daa.com.au/mailman/listinfo/pygtk
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk