Multi-OS screen capture utility
CsatiZoltan opened this issue · 2 comments
CsatiZoltan commented
The ImageGrab module cannot load under Linux:
Some plugin may be not loaded, but not affect others!
>>> menus/Plugins screencap_plg.py ImageGrab is macOS and Windows only
I recommend replacing it with the cross-platform and actively maintained pyscreenshot tool. The syntax would remain the same (see the Examples section of the previous link), so it's a drop-in replacement for ImageGrab.
If you don't want more dependencies, just use (copied from here)
import wx
wx.App() # Need to create an App instance before doing anything
screen = wx.ScreenDC()
size = screen.GetSize()
bmp = wx.EmptyBitmap(size[0], size[1])
mem = wx.MemoryDC(bmp)
mem.Blit(0, 0, size[0], size[1], screen, 0, 0)
del mem # Release bitmap
bmp.SaveFile('screenshot.png', wx.BITMAP_TYPE_PNG)
I tried it and works on multi-monitor setups as well. The advantage is that there is no additional dependency as wxpython is already a requirement for ImagePy.
yxdragon commented
ok, now replace the snapshot by wx. and add a countdown parameter (if what we want is not the imagepy's window).
CsatiZoltan commented
Nice.