tkinter: loading file before entering mainloop

Peter Billam peter at www.pjb.com.au
Sat Mar 14 06:26:02 EDT 2009


On 2009-03-14, Peter Otten <__peter__ at 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

-- 
Peter Billam       www.pjb.com.au    www.pjb.com.au/comp/contact.html



More information about the Python-list mailing list