469,275 Members | 1,549 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

Unreliable main window drag for Tkinter/Cygwin

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?
Jul 18 '05 #1
1 1576
> 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
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jörg Maier | last post: by
2 posts views Thread by James Ash | last post: by
4 posts views Thread by Grzegorz Dostatni | last post: by
5 posts views Thread by Sean McIlroy | last post: by
6 posts views Thread by William Gill | last post: by
reply views Thread by syed_saqib_ali | last post: by
1 post views Thread by syed_saqib_ali | last post: by
4 posts views Thread by mdmdmd | last post: by
reply views Thread by Tim Daneliuk | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.