Unreliable main window drag for Tkinter/Cygwin

Eric McRae eric at elmi.com
Mon Oct 25 15:08:58 CEST 2004


I have created a somewhat complicated GUI which updates itself every
1/2 second by checking on several non-blocking sockets for data and
modifying StringVars and/or canvas graphs when new information is
present.

The basic structure is:
======
from Tkinter import *

top=Tk()

#define a bunch of gui stuff

def guiUpdate():
    # check for new data and if necessary, update 5 small
    # canvasses (strip charts) and about 10 StringVars
    ...
    top.after(500, guiUpdate)

guiUpdate()
top.mainloop()
=======

This works just great on Linux.  It also works great on CygWin unless
I try to reposition the main window by dragging the title bar.  If I
am still holding the mouse button down when guiUpdate() runs, the main
window sometimes snaps back to its original position.  If I'm fast and
accomplish the reposition between updates, it's fine.  However, for a
normal reposition, the window almost always snaps back, making simple
repositioning irritating.

There are no explicit mouse event bindings on the top level window but
there are several static binds on enclosed widgets.  There are no
dynamic bindings anywhere.

My StripChart class creates a canvass 400 pixels wide.  Updates
involve inserting the new data point at the beginning of an array,
truncating the end of the array if necessary, deleting the previous
tagged line, and doing a create_line()using the updated array.

Since I wasn't sure how the stripchart would be used, I added a
self.canvas.update() at the end of my stripchart.update() method.  If
I comment out that line and just let top.mainloop() handle the
updates, everything seems to work fine.  Is there something wrong with
individual canvas updates?



More information about the Python-list mailing list