Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63159
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <johnmohagan@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.027 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'subject:same': 0.07; 'tkinter': 0.07; 'filename': 0.09; 'image,': 0.09; 'pil': 0.09; 'refresh': 0.09; 'python': 0.11; 'def': 0.12; 'qt,': 0.16; 'recipes': 0.16; 'subject:PIL': 0.16; 'subject:image': 0.16; 'subject:say': 0.16; 'tool.': 0.16; 'appropriate': 0.16; 'sender:addr:gmail.com': 0.17; 'thanks,': 0.17; 'written': 0.21; 'seems': 0.21; 'import': 0.22; 'separate': 0.22; 'first,': 0.26; 'involving': 0.30; "i'm": 0.30; 'code': 0.31; 'about.': 0.31; 'second,': 0.31; 'with,': 0.31; 'file': 0.32; 'subject:with': 0.35; 'display': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'charset:us-ascii': 0.36; 'two': 0.37; 'project': 0.37; 'window': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'launch': 0.39; 'to:addr:python.org': 0.39; 'signal': 0.60; 'subject:Update': 0.60; 'break': 0.61; 'john': 0.61; 'simply': 0.61; 'happen': 0.63; 'received:122': 0.63; 'more': 0.64; 'great': 0.65; 'explorer': 0.84; 'mars': 0.84; 'updated,': 0.84; 'windowing': 0.84; 'scores': 0.91; 'whereas': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-transfer-encoding; bh=c8NsIC1J+gVFgA2kHo4+/75gnWDKTnZn3iWYHLBRhj4=; b=RUh4Pnmx3oxaTTl+pv6BA9Ql+pITHNFlzjG6nliCTCmF7UgTx4InfE1jizjE6uUfI6 Wr2NXX43GvqQSP8WQMmWEXt65kISdzN1kz5nu+l344aXMX+FOQUxzFEplhh6lKu0tNWa tR5/+b9R1j0EAb7xvMWcdnX9ZZUaBCSxa+g+JesMmirMYjL8VkOzz8haCESDgBFd75wn 2aqISYoTiRKV1JkjmNakRmKAYcYlNTNfpmNWTKsSSRyS5yYpgScAnVTPxWYLeC3Lj7aD ENlHVbZA/0r1mLk5rrS9UvezTxfnGhVhiv1y+tYovBOCR5wix0BrX7IWbP7LeNhtZ9IQ V15A== |
| X-Received | by 10.68.136.162 with SMTP id qb2mr6646274pbb.88.1388886053546; Sat, 04 Jan 2014 17:40:53 -0800 (PST) |
| Sender | "John O'Hagan" <johnmohagan@gmail.com> |
| Date | Sun, 5 Jan 2014 12:40:46 +1100 |
| From | John O'Hagan <research@johnohagan.com> |
| To | python-list@python.org |
| Subject | Update image in same window with, say, PIL |
| X-Mailer | Claws Mail 3.9.3 (GTK+ 2.24.22; x86_64-pc-linux-gnu) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4923.1388886064.18130.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1388886064 news.xs4all.nl 2832 [2001:888:2000:d::a6]:44452 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63159 |
Show key headers only | View raw
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