Closed hollowheights closed 2 years ago
Your timer_callback()
is indented, so never called.
I don't think that's the problem - a possible mistake when I copied it in here with bad formatting on my part. I think it runs - since the file get's created on the desk.
You have an old file on disk. Indenting is wrong. See example line.py that takes a screenshot.
Thanks, Festiva! So simple and yet I had overlooked it completely. I have been looking through the examples, but don't see a way to plot in fullscreen - currently, my screenshots have low resolution.
I have read through this thread multiple times: https://github.com/highfestiva/finplot/issues/71 But I don't see how to close the plotting window via Python. I currently have:
def save(): fplt.screenshot(open('%s-%s.png' %(stock,date.date()), 'wb'))
`
fplt.timer_callback(save, 0.5, single_shot=True) # wait some until we're rendered
fplt.show()
fplt.close()
`
Place the close call inside the save method.
Thanks, that worked indeed. I still have the problem with the size of the screenshots though. I added
fplt.winw = 1920 fplt.winh = 1080
But the plots are moving around the screen, so the saved screenshot are only partial charts. Is there perhaps a way to simply maximize the window/fullscreen mode and save a screenshot of that?
fplt.create_plot('My Window', maximize=True)
I am plotting candlestick charts from a dataframe but can't save screenshots. Files are saving (as .png) but they are corrupted and can't be viewed. The plot itself shows just fine and I have seen no errors until I tried to implement the screenshot part.
I have copied the save function from the documentation. Since it isn't explicitly called, I'm assuming the .show() method checks for any function by the name of "save" and autoruns it.
Running this in PyCharm, I get no error messages. But again, the store files are not viewable.
Maybe there is something different about screenshotting when using candlestick charts?