Answer the question
In order to leave comments, you need to log in
[Tkinter] Zoom issues?
Greetings, I ran into a problem, it is necessary to make a code that will open a window inside which there will be a circle, but this circle should get bigger every second, I can’t make a cycle with a delay, I tried many options. I hope for your help. Using time, threadings code hangs
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root, width=2000, height=2000, borderwidth=0, highlightthickness=0, bg="black")
canvas.grid()
def _create_circle(self, x, y, r, **kwargs):
return self.create_oval(x-r, y-r, x+r, y+r, **kwargs)
tk.Canvas.create_circle = _create_circle
def _create_circle_arc(self, x, y, r, **kwargs):
if "start" in kwargs and "end" in kwargs:
kwargs["extent"] = kwargs["end"] - kwargs["start"]
del kwargs["end"]
return self.create_arc(x-r, y-r, x+r, y+r, **kwargs)
tk.Canvas.create_circle_arc = _create_circle_arc
for r in range(20, 200, 1):
canvas.create_circle(950, 500, r, fill="blue", outline="", width=4)
root.wm_title("Circles and Arcs")
root.mainloop()
Answer the question
In order to leave comments, you need to log in
Your approach is fundamentally wrong.
Look, you first have a loop, and then you run the application.
You need to read how the event-driven paradigm actually works.
Here is how to use timers: https://www.delftstack.com/en/howto/python-tkinter...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question