texttable

# Text Table (Tt) module

class vcs.texttable.Tt(Tt_name=None, Tt_name_src='default')[source]

The (Tt) Text Table lists text attribute set names that define the font, spacing, expansion, and color index.

This class is used to define an text table table entry used in VCS, or it can be used to change some or all of the text table attributes in an existing text table table entry.

Useful Functions:
# VCS Canvas Constructor
a=vcs.init()
# Show predefined text table objects
a.show('texttable')
# Updates the VCS Canvas at user's request
a.update()
Make a Canvas object to work with:
a=vcs.init()
Create a new instance of text table:
# Copies content of 'std' to 'new'
tt=a.createtexttable('new','std')
# Copies content of 'default' to 'new'
tt=a.createtexttable('new')
Modify an existing texttable:
tt=a.gettexttable('std')
Overview of texttable attributes:
  • Listing attributes:

    # Will list all the texttable attribute values
    tt.list()
    
  • Specify the text font type:

    # The font value must be in the range 1 to 9
    tt.font=1
    
  • Specify the text spacing:

    # The spacing value must be in the range -50 to 50
    tt.spacing=2
    
  • Specify the text expansion:

    # The expansion value must be in the range 50 to 150
    tt.expansion=100
    
  • Specify the text color:

    
    

    # The text color attribute value must be in the range 1 to 257 tt.color=241

  • Specify the text background color and opacity:

    # The text backgroundcolor attribute value must be in the range 1 to 257
    tt.backgroundcolor=241
    # The text backgroundopacity attribute value must be in the range 0 to 100
    tt.backgroundopacity=0
    # Set the graphics priority on the canvas
    tt.priority=1
    # FloatType [0,1]x[0,1]
    tt.viewport=[0, 1.0, 0,1.0]
    # FloatType [#,#]x[#,#]
    tt.worldcoordinate=[0,1.0,0,1.0]
    # List of FloatTypes
    tt.x=[[0,.1,.2], [.3,.4,.5]]
    # List of FloatTypes
    tt.y=[[.5,.4,.3], [.2,.1,0]]
    
list()[source]

Lists the current values of object attributes

Example
>>> a=vcs.init()
>>> obj=a.gettexttable() # default
>>> obj.list() # print texttable attributes
---------- ... ----------
...
script(script_filename=None, mode=None)[source]

Saves out a copy of the texttable secondary method, in JSON or Python format to a designated file.

Note

If the the filename has a ‘.py’ at the end, it will produce a Python script. If no extension is given, then by default a .json file containing a JSON serialization of the object’s data will be produced.

Warning

VCS Scripts Deprecated. SCR script files are no longer generated by this function.

Example
>>> a=vcs.init()
>>> ex=a.gettexttable()
>>> ex.script('filename.py') # append to 'filename.py'
>>> ex.script('filename','w') # make/overwrite 'filename.json'
Parameters
  • script_filename (str) – Output name of the script file. If no extension is specified, a .json object is created.

  • mode (str) – Either ‘w’ for replace, or ‘a’ for append. Defaults to ‘a’, if not specified.