Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108960

Re: Image loading problem

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Michael Torrie <torriem@gmail.com>
Newsgroups comp.lang.python
Subject Re: Image loading problem
Date Sun, 22 May 2016 13:37:55 -0600
Lines 18
Message-ID <mailman.7.1463945887.20402.python-list@python.org> (permalink)
References <743e5fbe-3a6c-49ea-ac5e-9bc055f652b5@googlegroups.com> <nhq3sl$hv8$1@ger.gmane.org> <1463860505.689253.614738601.76B18B37@webmail.messagingengine.com> <9341584a-bbdb-c9c8-2cf2-d631671631d3@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de 9y1IZ4+CG20SMVKLonWCswfcofvGIGZXclrhWqEjwqvA==
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'essentially': 0.04; '21,': 0.07; 'counting': 0.07; 'wrapped': 0.07; 'tcl/tk': 0.09; 'python': 0.10; 'python.': 0.11; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'means.': 0.16; 'mismatch': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrappers': 0.16; 'wrote:': 0.16; 'odd': 0.18; 'prevent': 0.20; 'bug?': 0.22; 'subject:problem': 0.22; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'header:User-Agent:1': 0.26; 'object,': 0.27; 'correct': 0.28; 'objects': 0.29; "i'm": 0.30; 'run': 0.33; 'problem': 0.33; 'message-id:@gmail.com': 0.34; 'languages': 0.34; 'could': 0.35; 'c++': 0.35; 'instance': 0.35; 'label': 0.35; "isn't": 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'being': 0.37; 'received:org': 0.37; 'why': 0.39; 'sure': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'charset:windows-1252': 0.62; 'different': 0.63; 'between': 0.65; 'counting.': 0.84; 'otten': 0.84
X-Virus-Scanned amavisd-new at torriefamily.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0
In-Reply-To <1463860505.689253.614738601.76B18B37@webmail.messagingengine.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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>
X-Mailman-Original-Message-ID <9341584a-bbdb-c9c8-2cf2-d631671631d3@gmail.com>
X-Mailman-Original-References <743e5fbe-3a6c-49ea-ac5e-9bc055f652b5@googlegroups.com> <nhq3sl$hv8$1@ger.gmane.org> <1463860505.689253.614738601.76B18B37@webmail.messagingengine.com>
Xref csiph.com comp.lang.python:108960

Show key headers only | View raw


On 05/21/2016 01:55 PM, Random832 wrote:
> On Sat, May 21, 2016, at 12:54, Peter Otten wrote:
>> It's not your fault, there's an odd quirk in the library: you have to
>> keep a reference of the PhotoImage instance around to prevent the
>> image from being garbage-collected.
> 
> Just out of curiosity, why is this a "quirk" and not a bug? Why isn't
> the reference held by the Label?

The reference is indeed held by the label but the problem is the label
is a Tcl/Tk object, thinly wrapped in Python.  It's essentially an
impedance mismatch between two different languages and object models
that each do their own reference holding and counting. I've run into
this issue with PySide also as one is instantiating C++ objects that do
their own internal reference counting through the Python wrapper.

I'm sure Python wrappers could try to correct for this somewhat, but
it's not a trivial thing to solve by any means.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Image loading problem "sweating_ant@yahoo.com" <huey.y.jiang@gmail.com> - 2016-05-21 08:22 -0700
  Re: Image loading problem Peter Otten <__peter__@web.de> - 2016-05-21 18:54 +0200
  Re: Image loading problem Peter Pearson <pkpearson@nowhere.invalid> - 2016-05-21 17:10 +0000
  Re: Image loading problem Gary Herron <gherron@digipen.edu> - 2016-05-21 10:16 -0700
  Re: Image loading problem Terry Reedy <tjreedy@udel.edu> - 2016-05-21 15:23 -0400
  Re: Image loading problem Random832 <random832@fastmail.com> - 2016-05-21 15:55 -0400
  Re: Image loading problem huey.y.jiang@gmail.com - 2016-05-21 21:01 -0700
  Re: Image loading problem Peter Otten <__peter__@web.de> - 2016-05-22 11:03 +0200
  Re: Image loading problem Michael Torrie <torriem@gmail.com> - 2016-05-22 13:37 -0600
  Re: Image loading problem Random832 <random832@fastmail.com> - 2016-05-22 16:19 -0400
    Re: Image loading problem Christian Gollwitzer <auriocus@gmx.de> - 2016-05-22 22:57 +0200

csiph-web