Table of Contents

Class: AutoSimVizGUI py4cs/ParameterInterface.py

Organize a set of widgets for input data together with buttons for running a simulator and performing visualizations. The input data are represented by a Parameters object from the ParameterInterface module. The individual parameters in this object are represented as InputPrmGUI instances. The application code creates Parameters object (recall to call addend() after all parameters are registered).

The method make_prmGUI takes the Parameters objects, makes the associated widgets and packs them in an appropriate GUI. All widgets may appear in one column, in the order the parameters were registered in the Parameters object, if sort_widgets is false. Otherwise, two column of widgets are made: one with sliders and one with the rest (checkbuttons, entries, options). The sequence of widgets in the latter case is determined by the sequence of registration in the Parameters, e.g., all sliders are grouped in their original sequence, all option menus are grouped in their original sequence, and so on.

The method make_buttonGUI creates buttons for simulation and visualization, plus an optional logo and a help button. If more buttons are wanted, one can add these to the button_frame Tkinter.Frame attribute.

There is an optional column of widgets with BLT graphs for curve plotting, enabled by the make_curveplotGUI method.

The great advantage of this class is that the application code can concentrate on defining input parameters to a problem, the simulation and visualization functions, and leave it to this class to put everything together. It is then an easy task to change the layout of the whole GUI in one common place.

Methods   
__init__
_helpwindow
_quit
load_curveplot
make_buttonGUI
make_curveplotGUI
make_prmGUI
update_curveplot
  __init__ 
__init__ ( self )

  _helpwindow 
_helpwindow ( self )

Launch a separate toplevel window with a scrolled text widget containing self.description.

  _quit 
_quit ( self,  event=None )

  load_curveplot 
load_curveplot (
        self,
        filename,
        graph,
        curvename='',
        )

Load data from a two-column file into x and y Blt vectors. graph is a Pmw.Blt.Graph widget, normally returned from make_curveplotGUI.

x, y = self.someGUI.load_curveplot(my.dat, self.plot2, curvename=measured data)

One can convert x and y, which are plain Python lists, to NumPy arrays for further processing if desired.

Exceptions   
TypeError, 'graph argument is a list of length %d>1, should be scalar' % len( graph )
  make_buttonGUI 
make_buttonGUI (
        self,
        parent,
        buttons=[],
        logo=None,
        help=None,
        )

  make_curveplotGUI 
make_curveplotGUI (
        self,
        parent,
        no_of_plotframes=1,
        placement='right',
        )

parent parent (master) widget no_of_plotframes no of graph areas placement placement of the plot area (right or bottom)

Example: Create three plot areas to the right in the window. self.plot1, self.plot2, self.plot3 = self.someGUI.make_curveplotGUI(parent, 3, right) self.plot1 etc. holds Pmw.Blt.Graph widgets.

Create a single plot area: self.plot1 = self.someGUI.make_curveplotGUI(parent, 1, bottom)

  make_prmGUI 
make_prmGUI (
        self,
        parent,
        parameters,
        sort_widgets=0,
        height=None,
        pane=0,
        )

The height parameter controls the height (in pixels) of the GUI.

The columns are realized by Pmw.ScrolledFrame widgets.

Exceptions   
TypeError, "widget_type attribute " "must be set for InputPrmGUI '%s'" % obj.name
  update_curveplot 
update_curveplot (
        self,
        filename,
        graph,
        )

Update Blt vectors with data from a two-column file.


Table of Contents

This document was automatically generated on Sun Mar 14 15:31:01 2004 by HappyDoc version 2.1