Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63159
| Date | 2014-01-05 12:40 +1100 |
|---|---|
| From | John O'Hagan <research@johnohagan.com> |
| Subject | Update image in same window with, say, PIL |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4923.1388886064.18130.python-list@python.org> (permalink) |
I'm using something like the following to display an image and refresh
it in the same window each time the image file is updated:
import cv
def display(filename):
"""Display scores as they are created"""
cv.NamedWindow(filename)
while 1:
... #wait for signal that filename has been updated,
#or to break
image = cv.LoadImage(filename)
cv.ShowImage(filename, image)
cv.WaitKey(1000)
I would like to do the same thing using PIL, for two reasons. First,
the main project is written in Python 3, but cv is only available in
Python 2, so I have to launch the above as a separate process and do
IPC with it, which is annoying; whereas PIL has recently come into
Python 3. Second, PIL seems like a more appropriate tool. CV is a
sophisticated computer-vision project which I happen to be more
familiar with, but I'm using it just to display an image, so I feel as
if I'm using the Mars Explorer to vacuum my apartment.
I have found a couple of StackOverflow and ActiveState recipes to do
this but they all seem to involve great globs of windowing code
involving Tkinter or Qt, which I know nothing about. CV does seem to
magically manage the windowing. Can I do this equally simply with PIL,
or perhaps something else in Python 3?
Thanks,
--
John
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Update image in same window with, say, PIL John O'Hagan <research@johnohagan.com> - 2014-01-05 12:40 +1100
csiph-web