bspy.viewer
A tkinter viewer (tkinter.Tk) that hosts a SplineOpenGLFrame, a treeview full of
splines, and a set of controls to adjust and view the selected splines.
See Also
Graphics: A graphics engine to display splines. It launches a Viewer and issues commands to the viewer.
Examples
Creates a Viewer, lists three splines, drawing (selecting) the third, and launches the viewer (blocks on the main loop).
>>> viewer = Viewer()
>>> viewer.list(spline1)
>>> viewer.list(spline2)
>>> viewer.draw(spline3)
>>> viewer.mainloop()
Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will be created. BASENAME will be used for the identification of the profile file (see readprofile). It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME is the name of the widget class.
List a Spline, Boundary, or Solid in the treeview. Can be called before viewer is running.
List a Spline, Boundary, or Solid in the treeview. Can be called before viewer is running.
List a Spline, Boundary, or Solid in the treeview and draw it in the viewer. Can be called before viewer is running.
Set the background color.
Parameters
- r (
float,intor array-like of floats or ints): The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default). - g (
floatorint): The green value [0, 1] as a float or [0, 255] as an int. - b (
floatorint): The blue value [0, 1] as a float or [0, 255] as an int. - a (
float,int, or None): The alpha value [0, 1] as a float or [0, 255] as an int. IfNonethen alpha is set to 1.
Update the spline draw list, set the default view, reset the bounds, and refresh the frame.
Gets the fill color of the spline (only useful for nInd >= 2).
Parameters
- spline (
Spline): The referenced spline.
Returns
- fillColor (
numpy.array): Array of four floats (r, g, b, a) in the range [0, 1].
Set the fill color of the spline (only useful for nInd >= 2).
Parameters
- spline (
Spline): The referenced spline. - r (
float,intor array-like of floats or ints): The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default). - g (
floatorint): The green value [0, 1] as a float or [0, 255] as an int. - b (
floatorint): The blue value [0, 1] as a float or [0, 255] as an int. - a (
float,int, or None): The alpha value [0, 1] as a float or [0, 255] as an int. IfNonethen alpha is set to 1.
Gets the line color of the spline.
Parameters
- spline (
Spline): The referenced spline.
Returns
- lineColor (
numpy.array): Array of four floats (r, g, b, a) in the range [0, 1].
Set the line color of the spline.
Parameters
- spline (
Spline): The referenced spline. - r (
float,intor array-like of floats or ints): The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default). - g (
floatorint): The green value [0, 1] as a float or [0, 255] as an int. - b (
floatorint): The blue value [0, 1] as a float or [0, 255] as an int. - a (
float,int, or None): The alpha value [0, 1] as a float or [0, 255] as an int. IfNonethen alpha is set to 1.
Gets the draw options for the spline.
Parameters
- spline (
Spline): The referenced spline.
Returns
- options (
intbitwise or (|) of zero or more of the following values:):SplineOpenGLFrame.HULLDraw the convex hull of the spline (the coefficients). Off by default.SplineOpenGLFrame.SHADEDDraw the spline shaded (only useful for nInd >= 2). On by default.SplineOpenGLFrame.BOUNDARYDraw the boundary of the spline in the line color (only useful for nInd >= 2). On by default.SplineOpenGLFrame.ISOPARMSDraw the lines of constant knot values of the spline in the line color (only useful for nInd >= 2). Off by default.
Set the draw options for the spline.
Parameters
- spline (
Spline): The referenced spline. - options (
intbitwise or (|) of zero or more of the following values:):SplineOpenGLFrame.HULLDraw the convex hull of the spline (the coefficients). Off by default.SplineOpenGLFrame.SHADEDDraw the spline shaded (only useful for nInd >= 2). On by default.SplineOpenGLFrame.BOUNDARYDraw the boundary of the spline in the line color (only useful for nInd >= 2). On by default.SplineOpenGLFrame.ISOPARMSDraw the lines of constant knot values of the spline in the line color (only useful for nInd >= 2). Off by default.
Get the independent variable that is animated (None if there is none).
Parameters
- spline (
Spline): The referenced spline.
Returns
- animate (
intorNone): The index of the independent variable that is animated (None is there is none).
Set the independent variable that is animated (None if there is none).
Parameters
- spline (
Spline): The referenced spline. - animate (
intorNone): The index of the independent variable that is animated (None is there is none).
Inherited Members
- tkinter.Tk
- master
- children
- tk
- loadtk
- destroy
- readprofile
- report_callback_exception
- tkinter.Misc
- deletecommand
- tk_strictMotif
- tk_bisque
- tk_setPalette
- wait_variable
- waitvar
- wait_window
- wait_visibility
- setvar
- getvar
- getint
- getdouble
- getboolean
- focus_set
- focus
- focus_force
- focus_get
- focus_displayof
- focus_lastfor
- tk_focusFollowsMouse
- tk_focusNext
- tk_focusPrev
- after
- after_idle
- after_cancel
- bell
- clipboard_get
- clipboard_clear
- clipboard_append
- grab_current
- grab_release
- grab_set
- grab_set_global
- grab_status
- option_add
- option_clear
- option_get
- option_readfile
- selection_clear
- selection_get
- selection_handle
- selection_own
- selection_own_get
- send
- lower
- tkraise
- lift
- winfo_atom
- winfo_atomname
- winfo_cells
- winfo_children
- winfo_class
- winfo_colormapfull
- winfo_containing
- winfo_depth
- winfo_exists
- winfo_fpixels
- winfo_geometry
- winfo_height
- winfo_id
- winfo_interps
- winfo_ismapped
- winfo_manager
- winfo_name
- winfo_parent
- winfo_pathname
- winfo_pixels
- winfo_pointerx
- winfo_pointerxy
- winfo_pointery
- winfo_reqheight
- winfo_reqwidth
- winfo_rgb
- winfo_rootx
- winfo_rooty
- winfo_screen
- winfo_screencells
- winfo_screendepth
- winfo_screenheight
- winfo_screenmmheight
- winfo_screenmmwidth
- winfo_screenvisual
- winfo_screenwidth
- winfo_server
- winfo_toplevel
- winfo_viewable
- winfo_visual
- winfo_visualid
- winfo_visualsavailable
- winfo_vrootheight
- winfo_vrootwidth
- winfo_vrootx
- winfo_vrooty
- winfo_width
- winfo_x
- winfo_y
- update_idletasks
- bind
- unbind
- bind_all
- unbind_all
- bind_class
- unbind_class
- mainloop
- quit
- nametowidget
- register
- configure
- config
- cget
- keys
- pack_propagate
- propagate
- pack_slaves
- slaves
- place_slaves
- grid_anchor
- anchor
- grid_bbox
- bbox
- grid_columnconfigure
- columnconfigure
- grid_location
- grid_propagate
- grid_rowconfigure
- rowconfigure
- grid_size
- size
- grid_slaves
- event_add
- event_delete
- event_generate
- event_info
- image_names
- image_types
- tkinter.Wm
- wm_aspect
- aspect
- wm_attributes
- attributes
- wm_client
- client
- wm_colormapwindows
- colormapwindows
- wm_command
- command
- wm_deiconify
- deiconify
- wm_focusmodel
- focusmodel
- wm_forget
- forget
- wm_frame
- wm_geometry
- geometry
- wm_grid
- grid
- wm_group
- group
- wm_iconbitmap
- iconbitmap
- wm_iconify
- iconify
- wm_iconmask
- iconmask
- wm_iconname
- iconname
- wm_iconphoto
- iconphoto
- wm_iconposition
- iconposition
- wm_iconwindow
- iconwindow
- wm_manage
- manage
- wm_maxsize
- maxsize
- wm_minsize
- minsize
- wm_overrideredirect
- overrideredirect
- wm_positionfrom
- positionfrom
- wm_protocol
- protocol
- wm_resizable
- resizable
- wm_sizefrom
- sizefrom
- wm_state
- state
- wm_title
- title
- wm_transient
- transient
- wm_withdraw
- withdraw
A graphics engine to script and display splines. It launches a Viewer and issues commands to the viewer.
Parameters
- variableDictionary (
dict): A dictionary of variable names, typicallylocals(), used to assign names to splines.
See Also
Viewer: A tkinter app (tkinter.Tk) that hosts a SplineOpenGLFrame, a treeview full of
splines, and a set of controls to adjust and view the selected splines.
Examples
Launch a Viewer and tell it to draw some splines.
>>> graphics = Graphics(locals())
>>> graphics.draw(spline1)
>>> graphics.draw(spline2)
>>> graphics.draw(spline3)
List a Spline, Boundary, or Solid in the treeview. Can be called before viewer is running.
List a Spline, Boundary, or Solid in the treeview. Can be called before viewer is running.
List a Spline, Boundary, or Solid in the treeview and draw it in the viewer. Can be called before viewer is running.
Set the background color.
Parameters
- r (
float,intor array-like of floats or ints): The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default). - g (
floatorint): The green value [0, 1] as a float or [0, 255] as an int. - b (
floatorint): The blue value [0, 1] as a float or [0, 255] as an int. - a (
float,int, or None): The alpha value [0, 1] as a float or [0, 255] as an int. IfNonethen alpha is set to 1.
Gets the fill color of the spline (only useful for nInd >= 2).
Parameters
- spline (
Spline): The referenced spline.
Returns
- fillColor (
numpy.array): Array of four floats (r, g, b, a) in the range [0, 1].
Set the fill color of the spline (only useful for nInd >= 2).
Parameters
- spline (
Spline): The referenced spline. - r (
float,intor array-like of floats or ints): The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default). - g (
floatorint): The green value [0, 1] as a float or [0, 255] as an int. - b (
floatorint): The blue value [0, 1] as a float or [0, 255] as an int. - a (
float,int, or None): The alpha value [0, 1] as a float or [0, 255] as an int. IfNonethen alpha is set to 1.
Gets the line color of the spline.
Parameters
- spline (
Spline): The referenced spline.
Returns
- lineColor (
numpy.array): Array of four floats (r, g, b, a) in the range [0, 1].
Set the line color of the spline.
Parameters
- spline (
Spline): The referenced spline. - r (
float,intor array-like of floats or ints): The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default). - g (
floatorint): The green value [0, 1] as a float or [0, 255] as an int. - b (
floatorint): The blue value [0, 1] as a float or [0, 255] as an int. - a (
float,int, or None): The alpha value [0, 1] as a float or [0, 255] as an int. IfNonethen alpha is set to 1.
Gets the draw options for the spline.
Parameters
- spline (
Spline): The referenced spline.
Returns
- options (
intbitwise or (|) of zero or more of the following values:):SplineOpenGLFrame.HULLDraw the convex hull of the spline (the coefficients). Off by default.SplineOpenGLFrame.SHADEDDraw the spline shaded (only useful for nInd >= 2). On by default.SplineOpenGLFrame.BOUNDARYDraw the boundary of the spline in the line color (only useful for nInd >= 2). On by default.SplineOpenGLFrame.ISOPARMSDraw the lines of constant knot values of the spline in the line color (only useful for nInd >= 2). Off by default.
Set the draw options for the spline.
Parameters
- spline (
Spline): The referenced spline. - options (
intbitwise or (|) of zero or more of the following values:):SplineOpenGLFrame.HULLDraw the convex hull of the spline (the coefficients). Off by default.SplineOpenGLFrame.SHADEDDraw the spline shaded (only useful for nInd >= 2). On by default.SplineOpenGLFrame.BOUNDARYDraw the boundary of the spline in the line color (only useful for nInd >= 2). On by default.SplineOpenGLFrame.ISOPARMSDraw the lines of constant knot values of the spline in the line color (only useful for nInd >= 2). Off by default.