Skip to content

Commit

Permalink
Merge pull request #1100 from j042/ft-screenshot-fname
Browse files Browse the repository at this point in the history
avoid overwriting screenshots with `"S"` key
  • Loading branch information
marcomusy authored Apr 22, 2024
2 parents 2a9222c + 940af16 commit c5a93b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vedo/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4093,8 +4093,13 @@ def _default_keypress(self, iren, event) -> None:
return

elif key == "S":
vedo.file_io.screenshot("screenshot.png")
vedo.printc(r":camera: Saved rendering window to 'screenshot.png'", c="b")
fname = "screenshot.png"
i = 1
while os.path.isfile(fname):
fname = f"screenshot{i}.png"
i += 1
vedo.file_io.screenshot(fname)
vedo.printc(rf":camera: Saved rendering window to {fname}", c="b")
return

elif key == "C":
Expand Down

0 comments on commit c5a93b9

Please sign in to comment.