python - Recall a function every x milliseconds on Tkinter (Pygame's set_timer equivalent) -


i developping little application plotting network graph, showing "how fast ping is". here related code review post.

basically, have thread managing canvas. thread targets following method (simplified):

def update(self):     # draw vertical line on right of canvas     self.draw_line(tag="spike")      # move lines -1 px , delete lines outside canvas     # can long.     lines = list(self.canvas.find_withtag("spike"))     while len(lines) > self.width:         self.canvas.delete(lines.pop(0))     l in lines:         x0, y0, x1, y1 = self.canvas.coords(l)         self.canvas.coords(l, x0 - 1, y0, x1 - 1, y1)      # recall in 10ms     if self.alive:         self.root.after(10, self.update) 

so might think, function bit slow on large canvas (for example 800x600). because uses recall method after computation, have recall time of computation_time + 10ms. have recall time of exactly 10ms.

as saw on a post pygame method pygame.time.set_timer() kind of thing on pygame. know if there equivalent tkinter.

rergards,


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -