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

References <91e0adb0-e4ef-4847-881a-7325e9a781d3@googlegroups.com>
Date 2014-11-14 10:39 +1100
Subject Re: help please: tkinter grid layout is very slow
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15797.1415921951.18130.python-list@python.org> (permalink)

Show all headers | 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