grail.widgets.gmodeldim module

Version: 16.2

Table of Contents

Description

Contains the GModelDim widget helps to provide a consisten means for asking a user to indicate the model dimensions that they wish to work with.

Example

The following example posts a dialog that queries for model dimensions. The results of the query are synchronized via the grail.rtv variables. We then use the getrtv and the name of the variable to retrieve and display the contents of each variable out to the screen.

from grail.widgets import *
from grail import rtv

root = gwidgetinit()
root.title("GModelDim Example")

md = GModelDim(root,
               
minx=1, maxx=10,
               
minxrtv=rtv.IntegerRTV(name="varminx"),
               
maxxrtv=rtv.IntegerRTV(name="varmaxx"),

               
miny=1, maxy=10,
               
minyrtv=rtv.IntegerRTV(name="varminy"),
               
maxyrtv=rtv.IntegerRTV(name="varmaxy"),

               
minz=1, maxz=10,
               
minzrtv=rtv.IntegerRTV(name="varminz"),
               
maxzrtv=rtv.IntegerRTV(name="varmaxz"),
               
align='vertical')
md.pack()

root.mainloop()

# Display the contents of the variables.
VARIABLE_NAMES = ["varminx", "varmaxx", "varminy",
                  
"varmaxy", "varminz", "varmaxz"]
for varname in VARIABLE_NAMES:
   
var = rtv.getrtv(varname)
   
value = var.get()
   
print "%s: %d." % (varname, value)

The above script will create a window that will appear as follows,

Screen shot of the GModelDim widget.

Example of the GModelDim widget.

GModelDim Widget

The GModelDim widget inherits from,
class GModelDim([parent, **keywords])

Widget to help present and collect model dimensions.

Arguments:
parent : Tkinter.Frame
Parent widget, widget we insert into.
keywords
Variable keyword list defined below.
Keywords:
align : ['vertical'|'horizontal']
One of two string values that indicates how the minimum-maximum widgets are to be aligned.
minx : integer
Minimum value for x (equivalent to xminmax_min).
miny : integer
Minimum value for y (equivalent to yminmax_min).
minz : integer
Minimum value for z (equivalent to zminmax_min).
maxx : integer
Maximum value for x (equivalent to xminmax_max).
maxy : integer
Maximum value for y (equivalent to yminmax_max).
maxz : integer
Maximum value for z (equivalent to zminmax_max).
minxrtv : IntegerRTV
Variable for minimum x value in the GModelDim widget.
minyrtv : IntegerRTV
Variable for minimum y value in the GModelDim widget.
minzrtv : IntegerRTV
Variable for minimum z value in the GModelDim widget.
minxrtv : IntegerRTV
Variable for maximum x value in the GModelDim widget.
minyrtv : IntegerRTV
Variable for maximum y value in the GModelDim widget.
minzrtv : IntegerRTV
Variable for maximum z value in the GModelDim widget.
Components:
xminmax
The x GMinMax spinner widget.
yminmax
The y GMinMax spinner widget.
zminmax
The z GMinMax spinner widget.
Signals:

The follow signals are not found in the grail.const module, and are instead referenced by their strings.

"onxminchange()"
Emitted when the minimum x value changes.
"onyminchange()"
Emitted when the minimum y value changes.
"onzminchange()"
Emitted when the minimum z value changes.
"onxmaxchange()"
Emitted when the maximum x value changes.
"onymaxchange()"
Emitted when the maximum y value changes.
"onzmaxchange()"
Emitted when the maximum z value changes.
disable()
Set the GModelDim to ignore user events.
enable()
Set the GModelDim to respond to user events.
updatevars()
Force all vars to synchronize with the user's input.