Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80706
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'root': 0.05; 'column': 0.07; 'subject:help': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'toss': 0.09; 'jan': 0.12; 'col': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:slow': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'trying': 0.19; 'print': 0.22; 'header:User- Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'label': 0.30; 'subject:please': 0.30; "i'm": 0.30; 'thanks': 0.36; 'hi,': 0.36; 'should': 0.36; 'rich': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:i 50': 0.60; 'skip:o 30': 0.61; 'browser': 0.61; 'skip:n 10': 0.64; 'here': 0.66; 'skip:r 30': 0.69; 'received:fios.verizon.net': 0.84; 'subject:very': 0.91; 'received:108': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: help please: tkinter grid layout is very slow |
| Date | Thu, 13 Nov 2014 17:14:26 -0500 |
| References | <91e0adb0-e4ef-4847-881a-7325e9a781d3@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-108-16-203-145.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| In-Reply-To | <91e0adb0-e4ef-4847-881a-7325e9a781d3@googlegroups.com> |
| 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.15790.1415916887.18130.python-list@python.org> (permalink) |
| Lines | 43 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1415916887 news.xs4all.nl 2881 [2001:888:2000:d::a6]:54357 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:80706 |
Show key headers only | View raw
On 11/13/2014 3:45 PM, Rich Cook wrote:
> Hi, I'm trying to toss together an image browser in tkinter, and it is so slow it is unworkable. Here is my code. Can someone point out why it's so sloooow? :-) Thanks
>
> root = Tkinter.Tk()
> root.geometry("1000x280+300+300")
> label = Tkinter.Button(root, compound=Tkinter.TOP)
> label.pack()
>
> numimages = len(image_list)
> numcols = 6
> numrows = numimages/numcols
That should be numimages // numcols
> if numrows * numcols != numimages:
> numrows += 1
>
> frame = Tkinter.Frame(root)
> for col in range(numcols):
> frame.columnconfigure(col, pad=2)
>
> for row in range(numrows):
> frame.rowconfigure(row, pad=2)
>
> 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]) )
ImageTk? or Tkinter?
> b.grid(row=row, column = col)
>
> frame.pack()
>
> root.mainloop()
>
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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