Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'skip:[ 20': 0.04; 'canvas': 0.07; 'padding': 0.07; 'tkinter': 0.07; 'logic': 0.09; 'matplotlib': 0.09; 'prevents': 0.09; 'skip:t 60': 0.09; 'skip:t 70': 0.09; 'width': 0.09; 'window.': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'gui': 0.12; '640,': 0.16; '8bit%:1': 0.16; 'api,': 0.16; 'blend': 0.16; 'personally,': 0.16; 'resizing': 0.16; 'skip:u 60': 0.16; 'skip:\xa0 60': 0.16; 'tk()': 0.16; 'tkinter.': 0.16; 'utilize.': 0.16; 'wxpython': 0.16; 'wrote:': 0.18; 'library': 0.18; 'app': 0.19; "python's": 0.19; 'written': 0.21; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'library,': 0.24; 'skip:{ 20': 0.24; 'decide': 0.24; 'cc:2**0': 0.24; "i've": 0.25; '15,': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'point': 0.28; 'skip:p 30': 0.29; "doesn't": 0.30; 'returned': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'program,': 0.31; 'app.': 0.31; 'loads': 0.31; 'skip:i 60': 0.31; 'skip:r 60': 0.31; 'figure': 0.32; 'url:python': 0.33; 'older': 0.33; 'style': 0.33; 'maybe': 0.34; 'skip:d 20': 0.34; "i'd": 0.34; 'could': 0.34; 'problem': 0.35; 'skip:s 30': 0.35; 'usual': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'height': 0.36; 'url:listinfo': 0.36; 'similar': 0.36; 'url:org': 0.36; 'two': 0.37; 'performance': 0.37; 'skip:& 10': 0.38; 'window': 0.38; 'skip:[ 10': 0.38; 'issue': 0.38; 'fact': 0.38; 'pm,': 0.38; 'skip:& 20': 0.39; 'skip:p 20': 0.39; 'url:mail': 0.40; 'how': 0.40; 'around.': 0.60; 'issues,': 0.61; 'back': 0.62; 'more': 0.64; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'skip:r 30': 0.69; 'jul': 0.74; 'hoping': 0.75; '180': 0.84; 'around,': 0.84; 'done;': 0.84; 'forced': 0.84; '2013': 0.98 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:to :cc:content-type; bh=iY/uMTTT3FJeOGo533kf4QxOFsoTiZB9t01BzRq4Jag=; b=iRX8E9dBYU+CoRSFg6bDQQwAexJLU6n/vE0g0/Vdc9Ll5ON2N6MMGosEV2Z+CKIY1R lfQbwIEw5zaPcUuF96mSg3TVWMfh9Rn35mJ0lBkdrRM5/dy1hupZZ5ZJvRYHNdPcR3ge XLLVQQ8xEaXPA8KYIZuBumEe8roCa36zl5SZCPQDd181CC6q2WadS3k2R148xzJ9fZ6/ dlU8wrLMFojwh/XH2p/OzHLOXhaYIzl8lxsIMI3YLNhx1JQ6wouDzrXYyfNGKFBRP4Je XzdooRgrJg2s+CeUQ1YNFrVcbga6BOruBJBwRJ/6jC0REyu1fzlU68v8fOFG3G2f0A5/ 2sKQ== MIME-Version: 1.0 X-Received: by 10.229.153.133 with SMTP id k5mr1326504qcw.41.1374024721814; Tue, 16 Jul 2013 18:32:01 -0700 (PDT) In-Reply-To: References: Date: Tue, 16 Jul 2013 21:32:01 -0400 Subject: Re: tkinter redraw rates From: David Hutto To: fronagzen@gmail.com Content-Type: multipart/alternative; boundary=90e6ba10afb774e15104e1ab0f1d Cc: python-list 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: 169 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374024725 news.xs4all.nl 15873 [2001:888:2000:d::a6]:54006 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50770 --90e6ba10afb774e15104e1ab0f1d Content-Type: text/plain; charset=ISO-8859-1 I've had a similar problem with a tkinter/3D app. right now I'm looking toward Blender, and the Python API, but there is also wxpython, and the usual python's library gtk. There is also matplotlib with the ion window. but, I, personally, am going to go with Blender, and Python API, with maybe a few other imports, and if ctypes...includes if I remember C correctly without reference at this time the usages of returned data type values for you to utilize. But for the plainer answer I'd go with wxpython if you decide not to use a different library, and for a GDK, Blend On Tue, Jul 16, 2013 at 8:57 PM, wrote: > Hm. So I've written a GUI in tkinter. I've found two performance issues, I > was hoping someone could point me in the right direction. > > Firstly, I'm using an image as a border, namely: > > from tkinter import * > from tkinter import ttk > > root_frame = Tk() > root_frame.configure(background = 'black') > > img1 = PhotoImage("frameBorder", data=""" > R0lGODlhQABAAMIHAAAAABkfLTMrMzMrZjNVZjNVmUFch////ywAAAAAQABAAAAD9A > i63P4wykmrvTjrzbu/hlGMZGmeaBp2QmgIQSzPdG3fbShk+u3/wFkONAgaj7aBoWIo > Ip9P5aQFrSJfkpd1C2xluWDfEhIKm2mrh/bM9qrZ8MDYYYiz54263Yxn6PdgfQt/gF > uCCoSFVYcAiYpPjI6PR5GTVpWWUJiZV2SckJ6flKGiQZulP6eoN6qrNa2uM7CxMbO0 > trG4rrqrvKi+pcCiwp/EnMaZyJbKk8yPzorQhdKA1HuRMLQ0bnSSuYyN2mhZ2eLcD1 > > TicjtZ3sPgfu7J8A0EBOWfQxg5a4/87BtcCBxIsKDBgh8SKlzIsKHDhxAVJgAAOw==""") > > style = ttk.Style() > style.element_create("RoundedFrame", "image", "frameBorder", > border=30, sticky="nsew") > style.layout("RoundedFrame", [("RoundedFrame", {"sticky": "nsew"})]) > > input_frame = ttk.Frame(root_frame, > style = "RoundedFrame", > padding = 15, > width = 640, > height = 180 > ) > input_frame.pack(padx=10, pady=10) > > This works, yes, but is annoyingly laggy on an older computer when I try > to move the window around. I figure it's because the program has to keep > redrawing the image border when dragged around, and is exacerbated by the > fact that I have two of the imageborder frames in my application. How can I > remedy this? I've tried using a hard-drawn image on a Canvas instead of the > image border, but it's suboptimal because that prevents resizing the window. > > > The other performance issue I've found is that when the logic is running, > the app doesn't redraw. Ordinarily this would be acceptable, but as part of > my program, it loads data from a website, and during the load, the window > completely freezes up and doesn't respond until the download is done; as I > understand it, tkinter doesn't redraw until it is forced to by .update() or > control is given back to the mainloop. How can I force a more frequent > redraw rate? > -- > http://mail.python.org/mailman/listinfo/python-list > -- Best Regards, David Hutto *CEO:* *http://www.hitwebdevelopment.com* --90e6ba10afb774e15104e1ab0f1d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I've had a similar problem with a tkinter/3D= app. right now I'm looking toward Blender, and the Python API, but the= re is also wxpython, and the usual python's library gtk.

There is also matplotlib with the ion window. but, I, personally, am going = to go with Blender, and Python API, with maybe a few other imports, and if = ctypes...includes if I remember C correctly without reference at this time = the usages of returned data type values
for you to utilize.


But for the plainer answer I'd go = with wxpython if you decide not to use a different library, and for a GDK, = Blend


On Tue, Jul 16, 2013 at 8:57 PM, <fronagzen@gmail.com> wr= ote:
Hm. So I've written a GUI in tkinter. I've found two performance is= sues, I was hoping someone could point me in the right direction.

Firstly, I'm using an image as a border, namely:

from tkinter import *
from tkinter import ttk

root_frame =3D Tk()
root_frame.configure(background =3D 'black')

img1 =3D PhotoImage("frameBorder", data=3D"""
=A0 =A0 =A0 =A0R0lGODlhQABAAMIHAAAAABkfLTMrMzMrZjNVZjNVmUFch////ywAAAAAQABA= AAAD9A
=A0 =A0 =A0 =A0i63P4wykmrvTjrzbu/hlGMZGmeaBp2QmgIQSzPdG3fbShk+u3/wFkONAgaj7= aBoWIo
=A0 =A0 =A0 =A0Ip9P5aQFrSJfkpd1C2xluWDfEhIKm2mrh/bM9qrZ8MDYYYiz54263Yxn6Pdg= fQt/gF
=A0 =A0 =A0 =A0uCCoSFVYcAiYpPjI6PR5GTVpWWUJiZV2SckJ6flKGiQZulP6eoN6qrNa2uM7= CxMbO0
=A0 =A0 =A0 =A0trG4rrqrvKi+pcCiwp/EnMaZyJbKk8yPzorQhdKA1HuRMLQ0bnSSuYyN2mhZ= 2eLcD1
=A0 =A0 =A0 =A0TicjtZ3sPgfu7J8A0EBOWfQxg5a4/87BtcCBxIsKDBgh8SKlzIsKHDhxAVJg= AAOw=3D=3D""")

style =3D ttk.Style()
style.element_create("RoundedFrame", "image", "fra= meBorder",
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 border= =3D30, sticky=3D"nsew")
style.layout("RoundedFrame", [("RoundedFrame", {"s= ticky": "nsew"})])

input_frame =3D ttk.Frame(root_frame,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 style =3D "RoundedFram= e",
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 padding =3D 15,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 width =3D 640,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 height =3D 180
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 )
input_frame.pack(padx=3D10, pady=3D10)

This works, yes, but is annoyingly laggy on an older computer when I try to= move the window around. I figure it's because the program has to keep = redrawing the image border when dragged around, and is exacerbated by the f= act that I have two of the imageborder frames in my application. How can I = remedy this? I've tried using a hard-drawn image on a Canvas instead of= the image border, but it's suboptimal because that prevents resizing t= he window.


The other performance issue I've found is that when the logic is runnin= g, the app doesn't redraw. Ordinarily this would be acceptable, but as = part of my program, it loads data from a website, and during the load, the = window completely freezes up and doesn't respond until the download is = done; as I understand it, tkinter doesn't redraw until it is forced to = by .update() or control is given back to the mainloop. How can I force a mo= re frequent redraw rate?
--
http://mail.python.org/mailman/listinfo/python-list



--
Best Rega= rds,
David Hutto<= /span>
CEO: http://www.hitwebdevelopment.com
--90e6ba10afb774e15104e1ab0f1d--