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


Groups > comp.lang.python > #80722

Re: help please: tkinter grid layout is very slow

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.039
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; '(b)': 0.07; 'subject:help': 0.08; 'cc:addr:python-list': 0.11; '7:45': 0.16; 'col': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:slow': 0.16; 'wrote:': 0.18; 'memory': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'load': 0.23; '(a)': 0.24; 'instance,': 0.24; 'fairly': 0.24; 'cc:2**0': 0.24; 'somewhere': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'resolution': 0.29; 'am,': 0.29; 'subject:please': 0.30; 'message- id:@mail.gmail.com': 0.30; 'fri,': 0.33; 'display': 0.35; 'but': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'nov': 0.38; 'rich': 0.38; 'does': 0.39; 'how': 0.40; 'skip:i 50': 0.60; 'skip:o 30': 0.61; "you're": 0.61; 'commenting': 0.84; 'images?': 0.84; 'try,': 0.84; 'subject:very': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=OACt+InKg1f/C1YbHI3qyHqhucu/Pw266XWtt3hmTlY=; b=ME8LfopSggxB/uLansa8hwQJwV/ipAod4mbOYmAEt1XtpMPyg+jsCYtD50COTLU76h xqyIvlILcgBXhjmOkysR5x6ZkwGu+S1CkndFBBZZaGxiNyD4xTrVs4IlDfSJefLbfImz 4IfIyZM88nntmlwHoIvgEgAuOe3/bMbmBdugXT8Ve56Zkr9E6YrKrPLtxMANj6AVpTql Picmy7Q8ofjuYh4qPrndkhVL//sMCjauWUf+2/jEJ7HXy4A+OutSMxyJ6Fkg3m9sR+zX R1kcKxL4A6uDqyg/GTAcT1/Y19AO6Dvv4tIaEzCxVdqI3WHtcyHObVOrt4bCCuRAFniG uHHA==
MIME-Version 1.0
X-Received by 10.107.149.203 with SMTP id x194mr6238214iod.22.1415921948383; Thu, 13 Nov 2014 15:39:08 -0800 (PST)
In-Reply-To <91e0adb0-e4ef-4847-881a-7325e9a781d3@googlegroups.com>
References <91e0adb0-e4ef-4847-881a-7325e9a781d3@googlegroups.com>
Date Fri, 14 Nov 2014 10:39:08 +1100
Subject Re: help please: tkinter grid layout is very slow
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.15797.1415921951.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415921951 news.xs4all.nl 2951 [2001:888:2000:d::a6]:47967
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80722

Show key headers only | View raw


On Fri, Nov 14, 2014 at 7:45 AM, Rich Cook <wealthychef@gmail.com> wrote:
> print "There are", numimages, "images"  # 256 in fact...
> for imagenum, (row, col) in enumerate([(row,col) for row in range(numrows) for col in range(numcols)]):
>     b = Tkinter.Label(frame, compound = Tkinter.TOP)
>     b['text'] = os.path.basename(image_list[imagenum])
>     b['image'] = ImageTk.PhotoImage(Image.open(image_list[imagenum]) )

You're asking someone somewhere to load 256 images into memory and
display them. What's the resolution of these images? Do they need to
be scaled/cropped? That can be fairly expensive. How long does it
actually take to (a) load all those images, and (b) pack the frame?
Try, for instance, commenting out the b.grid() call, to force them all
to be loaded but not packed.

ChrisA

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


Thread

help please:  tkinter grid layout is very slow Rich Cook <wealthychef@gmail.com> - 2014-11-13 12:45 -0800
  Re: help please:  tkinter grid layout is very slow Terry Reedy <tjreedy@udel.edu> - 2014-11-13 17:14 -0500
  Re: help please: tkinter grid layout is very slow Chris Angelico <rosuav@gmail.com> - 2014-11-14 10:39 +1100

csiph-web