tkinter redraw rates

David Hutto dwightdhutto at gmail.com
Wed Jul 17 03:32:01 CEST 2013


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, <fronagzen at gmail.com> 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*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130716/a663c98c/attachment.html>


More information about the Python-list mailing list