Unreliable main window drag for Tkinter/Cygwin

E

Eric McRae

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?
 
J

Jason Harper

Is there something wrong with individual canvas updates?

Yes. `update' can cause event handling code to run at unexpected times;
it's considered problematic even in raw Tcl/Tk code. See
http://wiki.tcl.tk/1255 for more details.
Jason Harper
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top