On 4/28/18 1:22 PM, Steven Kirk wrote:
> Hello,
> Posted this on StackExchange, got nothing so far, decided to get more targeted
I don't have the time to look at stack exchange, sorry. :(
> I have Mayavi2 code in Python 3 using mlab that draws a spherical glyph at a
> specific location, then adds a mlab.Text object at the same 3D location, e.g.
> if a sphere glyph has already been placed at 3-D location (px,py,pz), then
> adding the Text object like this:
>
> Using the recorder, I discovered how to set the properties:
>
>
> textobj = self.scene.mlab.text(px,py,plabel, z=pz, name='Label '+plabel,
> color=self.modelcolors['labelcolor'],width=self.Text*0.004)
> textobj.property.bold = True # this works just fine, text becomes bold
> textobj.property.justification = 'centered' # moves Text far away ?
> textobj.property.vertical_justification = 'centered' # also far away ?
Basically by default the alignment is based on the size of the actor itself. So
the thing to do here perhaps would be to use
textobj.actor.text_scale_mode = 'viewport'
Then set the font size on the property to control the font size instead of using
the width to adjust the font size.
HTH.
Prabhu
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users