Answer the question
In order to leave comments, you need to log in
[Tkinter/Python] How to make a circle bigger in Tkinter?
Greetings. I ran into a problem, I need to write Python code using Tkinter, the essence of this code is: A window should open, and a circle should appear that will become larger every second (two), while the window should not close, I tried many options , and through Time, Threading, but the code just hangs. In general, briefly, it is necessary to make a cycle that will not be executed immediately, but every second, and the circle will gradually grow.
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question