[vtkusers] How to set font size in vtkScalarBarActor?

Theodore D. Sternberg tdsternberg at lbl.gov
Fri Mar 12 17:34:07 EST 2004


This question has been posed at least twice before on this mailing list, 
but no one answered it (at least not on the mailing list): how do you take 
control of the font size in vtkScalarBarActor?  As the little script below 
illustrates, you can call GetLabelTextProperty().SetFontSize all you want,
and nothing happens.  Of course the font size does change -- 
automatically, in reponse to the user stretching the render window.  So 
perhaps the real question is, How can I disable or override the 
vtkScalarBarActor's automatic font rescaling mechanism?

-----------------------------------------
import vtk

scalarBar = vtk.vtkScalarBarActor()
scalarBar.SetLookupTable( vtk.vtkPolyDataMapper().GetLookupTable() )
scalarBar.GetLabelTextProperty().SetFontSize(8)

ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
ren.AddActor(scalarBar)
renWin.Render()
-------------------------------------------

Ted Sternberg
Lawrence Berkeley National Laboratory





More information about the vtkusers mailing list