[vtkusers] Why Axis Labels (X,Y,Z) do not show (Axes.py)?
Kang Zhao
zhaokang.cn at gmail.com
Mon Jul 28 21:52:20 EDT 2014
Hi Mike,
Thanks a lot for your reply.
I did some further investigation and here are the findings:
- Upgrading PyOpenGL to 3.1.0 didn't help;
- The attached simple vtkTextActor example didn't work either ("Hello
World!" didn't show up).
I also tested on another machine (WinXP 32-bit, Python 2.7.5, VTK-Python
6.1.0), and it worked fine.
It seems something broken with my win7 machine. Will come back to share
if I get any new findings...
Thanks again.
Kang
于 2014/7/28 18:59, Mike Taverne 写道:
> I see the labels when running your script.
> Both with VTK 5.8.0 and VTK 6.1.0.
>
> Changing the text and its color also works.
>
> Maybe it is a rendering issue similar to the one I have with colors on
> surfaces creates from sampled implicit functions.
>
> I'm using python 2.7.6, but I don't think that's where the problem comes
> from.
>
> OS: Ubuntu 14.04.1 LTS (64bit)
> Python: 2.7.6 (64bit as well I guess, distro package)
> VTK: 5.8.0 from the ubuntu repositories and 6.1.0 compiled from source
>
> On 28/07/14 01:53, Kang Zhao wrote:
>> Hello,
>>
>> When I ran the attached Python script, the axis lables (X,Y,Z) didn't
>> show up. I also tried playing with
>> axes.GetXAxisCaptionActor2D().GetCaptionTextProperty.SetColor(1,0,0) and
>> SetXAxisLabelText(), but no success.
>>
>> PS, the script could be found at:
>> http://www.cmake.org/Wiki/VTK/Examples/Python/GeometricObjects/Display/Axes.
>>
>> Could anyone help to share some clue?
>>
>> My environment:
>>
>> OS: Windows 7 (64-bit)
>> Python: 2.7.7 (32 bit)
>> wxPython: wxPython2.8-win32-unicode-2.8.12.1-py27.exe
>> VTK: vtkpython-6.1.0-Windows-32bit.exe
>>
>> Thanks for your help in advance.
>>
>> Kang
>>
>>
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
-------------- next part --------------
import vtk
# create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# create a renderwindowinteractor
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create a text actor
txt = vtk.vtkTextActor()
txt.SetInput("Hello World!")
txtprop=txt.GetTextProperty()
txtprop.SetFontFamilyToArial()
txtprop.SetFontSize(18)
txtprop.SetColor(1,1,1)
txt.SetDisplayPosition(20,30)
# assign actor to the renderer
ren.AddActor(txt)
# enable user interface interactor
iren.Initialize()
renWin.Render()
iren.Start()
More information about the vtkusers
mailing list