Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved ImageShow documentation #6078

Merged
merged 2 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/reference/ImageShow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/PIL/ImageShow.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@

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:
Expand Down