Peter Billam wrote: > On 2009-03-14, Peter Otten <__pete...@web.de> wrote: >> Well, I don't know where the ymid[...] values come from. If you can >> guarantee that ymid[track_num] - ymid[track_num-1] > 50 at some point >> you could reschedule loadFile() from within loadFile() and return >> immediately as long as that condition is not met. > > They're multiplied up from > canvas_height = self.canvas.winfo_height() > so I guess mainloop already think it's idle, while grid is still taking > 10ms to work out what goes where. It's not a specifically canvas thing, > because to the left of the canvas there is a frame (called trackbar) > which has the same height, and self.trackbar.winfo_height() gives the > same effects. > > Your suggestion would also defend me against small screens, or midi- > -files with large numbers of tracks (I'll impose a max_retries)... > > Thanks, Regards, Peter > You need to query the requested width and height for windows which are not yet realised.
canvas_height = self.canvas.winfo_reqheight() Regards, John -- http://mail.python.org/mailman/listinfo/python-list