0

In python, tkinter's canvas has the property to keep track of whatever you draw on it and to redraw it correctly whenever you scroll it horizontally or vertically. However, if you want to draw an infinite line (e.g. a graph axis), since with the usual create_line method you need to specify the line's ends, you must always cover the risk of showing the end of your line by adapting them each time you scroll - which defeats the purpose of having a canvas which tracks objects and manages those changes of view for you.

Isn't there a good way to create a line which is really infinite ?

ps : this is NOT a duplicate of Draw an infinite line through 2 points? which just makes the line longer but does not really draws an infinite line

Camion
  • 1,264
  • 9
  • 22

1 Answers1

0

No, there is no support in tkinter to draw an infinite line. You must give coordinates for the endpoints.

Since the canvas itself isn't infinite, the best you can do is determine the limits of the canvas, and draw a line from edge to edge.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685