Merge pull request #6078 from radarhere/imageshow

This commit is contained in:
Hugo van Kemenade 2022-02-23 14:56:18 +02:00 committed by GitHub
commit 96516ce5f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -23,6 +23,9 @@ All default viewers convert the image to be shown to PNG format.
.. autoclass:: PIL.ImageShow.EogViewer
.. autoclass:: PIL.ImageShow.XVViewer
To provide maximum functionality on Unix-based systems, temporary files created
from images will not be automatically removed by Pillow.
.. autofunction:: PIL.ImageShow.register
.. autoclass:: PIL.ImageShow.Viewer
:member-order: bysource

View File

@ -25,7 +25,12 @@ _viewers = []
def register(viewer, order=1):
"""
The :py:func:`register` function is used to register additional viewers.
The :py:func:`register` function is used to register additional viewers::
from PIL import ImageShow
ImageShow.register(MyViewer()) # MyViewer will be used as a last resort
ImageShow.register(MySecondViewer(), 0) # MySecondViewer will be prioritised
ImageShow.register(ImageShow.XVViewer(), 0) # XVViewer will be prioritised
:param viewer: The viewer to be registered.
:param order: