Code Monkey home page Code Monkey logo

Comments (7)

m-albert avatar m-albert commented on July 17, 2024 1

The color difference is caused by the fact the first time the rendering window does not yet exist, so vtkplotter makes it a default grey,

Okay, that explains the grey. Still it's a bit strange that the second screenshot is also grey, as the rendering window already existed in the second iteration.

Yeah, must be something in my environment which is clearly a bit strange. For example, despite it being a clean anaconda installation on a fresh MacOS, executing the same code above with ipython gives me a segfault (in the screenshot command). Without screenshot, the rendering window is not displayed. In any case I'll try to reproduce the problem on another system soon.

Thanks for the help and I'll write here if I find out anything new in case anyone else stumbles upon a similar problem :)

from vedo.

marcomusy avatar marcomusy commented on July 17, 2024 1

Hi again, I tried on my mac and YES, i can reproduce the issue! i´ll investigate that, thanks for spotting the issue, and get back to you asap.

from vedo.

m-albert avatar m-albert commented on July 17, 2024 1

Hi Marco,

nice, after updating to your new version I get the same output as you!

As your comment says, embedWindow(False) is needed on ipython or jupyter. Also the normal python console seems to be fine with it.

Thanks a lot for following up on the issue!

Cheers,
Marvin

from vedo.

marcomusy avatar marcomusy commented on July 17, 2024

Hi @quakberto
thanks!
i cannot reproduce the problem.. are you running the latest version? try
pip install -U vtkplotter
Also, you cannot have a test_000 with i in the range of [1,2,3].
This gives me the expected output:

from vtkplotter import Text, screenshot, Plotter

vp = Plotter(axes=0, interactive=0)

for i in [0,1,2,3]:
    text = Text('%03d' %i, c='white')
    vp += text
    # vp += more objects..
    vp.show()
    screenshot('htest_%03d.png' %i)
    vp.remove(text)

image

Let me know if it still does not work for you,
cheers
Marco

from vedo.

m-albert avatar m-albert commented on July 17, 2024

Hi Marco,

thanks for the quick look!

i cannot reproduce the problem.. are you running the latest version? try
pip install -U vtkplotter

Indeed I was one release behind, however the behaviour I get remains the same.

Your code gives me this output (I just increased the text size ...,s=10)):
image

Also, you cannot have a test_000 with i in the range of [1,2,3].

Sorry, of course you're right, I meant test_002.png. Here's the output of the code I posted above:

image

Notice also the difference in text color.

Let me know if I can give you any info about my environment. In any case, I guess this could well be a problem outside of vtkplotter.

Cheers

from vedo.

marcomusy avatar marcomusy commented on July 17, 2024

that's funny... it must be something related to your python (?). In my ubuntu system with either python 2,3 your script gives the expected output.
Try maybe Text(str(i), c='white') and screenshot(str(i)+'.png')

The color difference is caused by the fact the first time the rendering window does not yet exist, so vtkplotter makes it a default grey, This is fixed by explicitly setting c='white'.

from vedo.

marcomusy avatar marcomusy commented on July 17, 2024

@quakberto
I think I fixed the issue... give it a try:

git clone https://github.com/marcomusy/vtkplotter.git
cd vtkplotter
pip install .

then:

from vtkplotter import *

#this is needed when using ipython or from jupyter:
#embedWindow(False) 

vp = Plotter(axes=0, interactive=0)

for i in [1,2,3]:
    text = Text('%03d' %i, c='white')
    vp += text
    vp += Sphere(c=i).x(i)
    vp.show()
    screenshot('test_%03d.png' %i)
    vp.remove(text)

image

Let me know if the issue persists,
Cheers, M.

from vedo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.