Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'programmer': 0.03; 'tkinter': 0.07; 'wednesday,': 0.07; 'method,': 0.09; 'output,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'gui': 0.12; 'thread': 0.14; 'doing,': 0.16; 'loop.': 0.16; 'loops': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'thread,': 0.16; 'unsafe': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'bit': 0.19; 'work,': 0.20; 'seems': 0.21; '>>>': 0.22; 'handles': 0.22; 'separate': 0.22; 'header:User-Agent:1': 0.23; 'first,': 0.26; 'updating': 0.26; 'second': 0.26; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'besides': 0.30; "i'm": 0.30; 'that.': 0.31; 'noted': 0.31; 'figure': 0.32; 'text': 0.33; 'says': 0.33; "can't": 0.35; 'advice': 0.35; 'knows': 0.35; 'something': 0.35; 'done.': 0.35; 'but': 0.35; 'really': 0.36; 'doing': 0.36; 'too': 0.37; 'displays': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'dave': 0.60; 'is.': 0.60; 'new': 0.61; "you're": 0.61; 'email addr:gmail.com': 0.63; 'july': 0.63; 'periodically': 0.68; 'different.': 0.84; 'angel': 0.91; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: tkinter redraw rates Date: Wed, 17 Jul 2013 07:42:45 -0400 References: <17c2ef71-ee2d-4229-9731-e0d54a0997cb@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 174.32.174.30 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374061383 news.xs4all.nl 15942 [2001:888:2000:d::a6]:44780 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50787 On 07/17/2013 07:10 AM, fronagzen@gmail.com wrote: > On Wednesday, July 17, 2013 6:07:22 PM UTC+8, Dave Angel wrote: >> On 07/16/2013 11:04 PM, fronagzen@gmail.com wrote: >> >>> Noted on the quoting thing. >>> Regarding the threading, well, first, I'm not so much a programmer as someone who knows a bit of how to program. >>> And it seems that the only way to update a tkinter window is to use the .update() method, which is what I was experimenting with. Start up a new thread that just loops the .update() with a 1ms sleep until the download is done. It seems to work, actually. >> >> update() is to be used when it's too awkward to return to mainloop. In >> my second approach, you would periodically call it inside the processing >> loop. But unless tkinter is unique among GUI's, it's unsafe to do that >> in any thread besides the GUI thread. >> >> -- >> >> DaveA > > Yes, based on advice from this thread, I'm doing that. From my main thread, I create a thread that handles the download while updating a variable that the mainloop displays as a text output, and in that mainloop, I have a while loop that updates the GUI until the downloading is done. > I can't figure out what you're really doing, since each message from you says something different. You don't need a separate while loop, since that's exactly what app.mainloop() is. -- DaveA