The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?
Peter Otten
__peter__ at web.de
Tue May 29 02:58:56 EDT 2018
Paul St George wrote:
> This is very helpful indeed, thank you. Awe-inspiring.
>
> It occurred to me that I could edit the PIL/ImageShow.py, replacing ‘xv’
> (in five places) with the utility of my choice and using ‘executable’ as
> the command.
>
> Or, is this just not done?
No, this tends to become a maintenance problem. Instead write a little
module of your own
from PIL import ImageShow
class MyViewer(ImageShow.UnixViewer):
def __init__(self, command):
self.command = command
def get_command_ex(self, file, **options):
return (self.command,) * 2
ImageShow.register(MyViewer("gwenview"), -1)
(replace "gwenview" with your favourite viewer) and import it before using
Image.show().
More information about the Python-list
mailing list