How about this:

>>> from gtk import *
>>> adj = GtkAdjustment()
>>> print adj.lower
0.0
>>> adj.lower = 1.0
>>> print adj.lower
1.0
>>>


:-)
Jeff


Bernhard Herzog wrote:
> 
> "J.W. Bizzaro" <[EMAIL PROTECTED]> writes:
> 
> > Have you tried using the mapping behavior of the object?
> >
> >     adj = GtkAdjustment()
> >     ...
> >     adj['lower'] = 10
> >
> > Just a guess.  I haven't used adjustments myself.  Can you send an example?
> 
> That was the first thing I tried, but it doesn't work. Minimal example:
> >>> from gtk import *
> >>> adj = GtkAdjustment()
> >>> adj['lower'] = 0
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python1.5/site-packages/gtk.py", line 50, in __setitem__
>     _gtk.gtk_object_set(self._o, {key: v});
> TypeError: could not find argument "lower" in the `GtkAdjustment' class ancestry
> >>>
> 
> The same thing happens in more complex setups where the adjustment is
> attached to a scrollbar, the widgets are shown and the code is called
> from the main loop.
> 
> From the gtk sources, it seems that in C I'd have to modify the members
> of the GtkAdjustment struct directly (from gtktext.c):
> 
> static void
> adjust_adj (GtkText* text, GtkAdjustment* adj)
> {
>   gint height;
> 
>   gdk_window_get_size (text->text_area, NULL, &height);
> 
>   adj->step_increment = MIN (adj->upper, (float) SCROLL_PIXELS);
>   adj->page_increment = MIN (adj->upper, height - (float) KEY_SCROLL_PIXELS);
>   adj->page_size      = MIN (adj->upper, height);
>   adj->value          = MIN (adj->value, adj->upper - adj->page_size);
>   adj->value          = MAX (adj->value, 0.0);
> 
>   gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
> }
> 
> Some background: I've begun to port Sketch to GTK. Porting the drawing
> code was relatively simple because Xlib and GDK, being a thin wrapper
> around Xlib, are very similar. The rest of the GUI will take a lot more
> work.
> 
> Now when I change the zoom factor in Sketch's canvas, I have to either
> change the adjustment's 'upper' and 'lower' or 'page_size' and the
> *increments.
> 
> --
> Bernhard Herzog   | Sketch, a python based drawing program
> [EMAIL PROTECTED]  | http://www.online.de/home/sketch/
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

-- 
J.W. Bizzaro                  mailto:[EMAIL PROTECTED]
Boston College Chemistry      http://www.uml.edu/Dept/Chem/Bizzaro/
--
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to