Search code examples
pythonscreenshot

Python [visvis] screenshot does not work


The following code to use visvis results in black image no capture, why?

import visvis

app = visvis.use()
visvis.plot([1,2,3],[1,3,2])
visvis.screenshot('c:/captured.png')        #something is wrong with this method

Note that adding

visvis.gcf().DrawNow()

before capture has no effect!

Googling has been completely useless for this case, so far!


Solution

  • The figure has not had a chance to draw itself at the time that you take the screenshot. Try putting app.ProcessEvents() before taking the screenshot.