1

I would like to be able to save a captured region to a png file on disk

The section of the code I have is:

r = Region(150,350,1700,630)
r.highlight(15)
screen = Screen()
image = screen.capture(r)

How to save now?

As mentioned in the documentation, tried to add a path and a name:

image = screen.capture(r, "/tmp", "aaa.png")

But returns an error:

[error] script [ finviz ] stopped with error in line 17
[error] TypeError ( capture(): expected 0-1 or 4 args; got 3 )
[error] --- Traceback --- error source first
line: module ( function ) statement 
17: main (  <module> )     image = screen.capture(r, "/tmp", "aaa.png")
[error] --- Traceback --- end --------------
Luis
  • 1,236
  • 5
  • 22
  • 31

1 Answers1

1

There's this obscure statement in the documentation:

(MUST be used as such undotted)

which, when applied blindly...

r = Region(150,350,1700,630)
filename = capture(r, "/tmp", "aaa.png")

...makes it work !

A. Richard
  • 240
  • 1
  • 6
  • I lost a couple of hours trying to make it work. Thank you so much, all the best to you. – Luis Mar 29 '23 at 17:54