| PyGTK Tutorial | ||
|---|---|---|
| <<< Previous | Chapter 8. Range Widgets | Next >>> |
vscale = GtkVScale(adjustment) hscale = GtkHScale(adjustment) |
The adjustment argument can either be an adjustment which has already been created with GtkAdjustment(), or nothing, in which case, an anonymous Adjustment is created with all of its values set to 0.0 (which isn't very useful in this case). In order to avoid confusing yourself, you probably want to create your adjustment with a page_size of 0.0 so that its upper value actually corresponds to the highest value the user can select. (If you're already thoroughly confused, read the section on Adjustments again for an explanation of what exactly adjustments do and how to create and manipulate them.)
sacle.set_draw_value(draw_value) |
As you might have guessed, draw_value is either TRUE or FALSE, with predictable consequences for either one.
The value displayed by a scale
widget is rounded to one decimal point by default, as is the value
field in its GtkAdjustment. You can change this with:
scale.set_digits(digits) |
where digits is the number of decimal places you want. You can set digits to anything you like, but no more than 13 decimal places will actually be drawn on screen.
Finally, the value can be drawn in different
positions relative to the trough:
scale.set_value_pos(pos) |
The argument poscan
take one of the following values:
POS_LEFT POS_RIGHT POS_TOP POS_BOTTOM |
If you position the value on the "side"
of the trough (e.g., on the top or bottom of a horizontal scale widget),
then it will follow the slider up and down the trough.
| <<< Previous | Home | Next >>> |
| Range Widgets | Up | Common Range Functions |