================================ ``grail.widgets.gminmax`` module ================================ .. include:: ../../version.h .. include:: ref.h .. contents:: Table of Contents :backlinks: top ----------- Description ----------- The :c:`GMinMax` widget is useful for asking users for a minimum and maximum integer range. The widget has error checking to ensure that the maximum value is always greater than the minimum value. You may also attach :c:`IntegerRTV` variables to both the minimum and maximum value fields to provide instant update of your local data when the user updates this widget. ------- Example ------- The following example creates a window that will have two :c:`IntegerRTV` objects associated with it. When the window is closed, the contents of the :c:`IntegerRTV` objects will be printed out. .. Python:: from grail.widgets import * from grail.rtv import IntegerRTV root = gwidgetinit() root.title("GMinMax Example") minrtv = IntegerRTV(name='__gminmax_test_min') maxrtv = IntegerRTV(name='__gminmax_test_max') mm = GMinMax(root, group_text="Example min/max entry", rtv_min=minrtv, rtv_max=maxrtv, min=0, max=10) mm.pack() root.mainloop() print "minimum: %d." % (minrtv.get()) print "maximum: %d." % (maxrtv.get()) The above script will create a window that will appear as follows, .. figure:: figure-gminmax-example.gif :alt: Screen shot of the GMinMax widget. Example of the :c:`GMinMax` widget. -------------- GMinMax Widget -------------- The :c:`GMinMax` widget inherits from, * :c:`gwidget.GWidget` (grail.widgets.gwidget_) * :c:`objsignal.Emitter` (grail.objsignal_) class :dc:`GMinMax([parent, **keywords])` Widget used to collect minimum-maximum data via spinners. Arguments: :a:`parent` : :c:`Tkinter.Frame` Parent widget, widget we insert into. :a:`keywords` Variable keyword list defined below. Keywords: :a:`min` : integer Smallest valid value (default is :d:`-sys.maxint`). :a:`max` : integer Largest valid value (default is :d:`sys.maxint`). :a:`rtv_min` : :c:`IntegerRTV` Attaches a grail.rtv_ variable with the minimum value box. :a:`rtv_max` : :c:`IntegerRTV` Attaches a grail.rtv_ variable with the maximum value box. Components: minlabel_text Label for the minimum entry. maxlabel_text Label for the maximum entry. minspinner Spinner for the minimum entry. maxspinner Spinner for the maximum entry. Signals: :d:`const.sigON_MIN_CHANGE` Emitted when the minimum entry changes. :d:`const.sigON_MAX_CHANGE` Emitted when the maximum entry changes. :df:`destroy()` Cleans up listner's and destroys the widget. :df:`disable()` Set the :c:`GMinMax` widget to ignore user events. :df:`enable()` Set the :c:`GMinMax` widget to respond to user events. :df:`updatevars()` Force all vars to synchronize with the user's input.