You could simplify the the call to connect to just this:
adjustment.connect("value_changed", self.set_free_dim, count)
AFAIK, connecting to the value_changed (or changed) signal of an
adjustment is the only way to get notified of these changes. The
scrollbars use the changed signal to trigger redraws for instance.
Instead of creating the adjustment in advance, you could just create the
scale, without specifying the adjustment. Then use this:
adjustment = scale.get_adjustment()
I hope this helps,
James Henstridge.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
On Thu, 7 Jan 1999, Janko Hauser wrote:
> Hello, I try to build a simple dataviewer with PyGtk. I want to use a
> Scale widget to step through the free dimensions of the
> multidimensional data.
>
> Q: I use following code
>
> adjustment = GtkAdjustment(0, 0, dim_end, 1, 1, 1)
> adjustment.connect("value-changed", lambda _b, barg=count,
> adj=adjustment,
> cb=self.set_free_dim: cb(adj, barg))
>
> self.scales[count] = GtkHScale(adjustment)
> self.scales[count].set_usize(150, 30)
> self.scales[count].set_update_policy(UPDATE_DISCONTINUOUS)
> self.scales[count].set_digits(0)
> self.scales[count].set_draw_value(TRUE)
> table.attach(self.scales[count], 2, 3, count+1, count+2)
> self.scales[count].show()
>
>
> with this dummy callback (barg/count is the number of the dimension)
>
> def set_free_dim(self, adj, count):
> print adj.value, count
>
> Is there no other way to get the value of the adjustment in the
> callback? This looks not obvious to me.
>
>
> Next question:
>
> I want to disable the scale widget for the non-free dimensions and use
>
> self.scales[num].set_state(STATE_INSENSITIVE)
>
> for this. How can I reactivate the scale? I have tried the other
> STATE_* parameters without success.
>
> In the end I wonder what other people are programming. Are there
> efforts do make higher level widgets? I like pygtk and want to thank
> for this nice and promising package.
>
> TIA
>
> __Janko Hauser
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
>
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]