Намалюйте у ТКinter
даю 100 балів
(надішліть код)
Ответы
Спочатку встанови бiблiотеку Tkinter командою
pip install tkinter
Далi напиши код:
import tkinter as tk
window = tk.Tk()
canvas = tk.Canvas(window, width=200, height=200)
canvas.pack()
def draw_face(x, y, radius, color, color2, width):
canvas.create_oval(x - radius, y - radius, x + radius, y + radius, fill=color, outline=color2, width=width)
def draw_circle(x, y, radius, color, color2, width):
canvas.create_oval(x - radius, y - radius, x + radius, y + radius, fill=color, outline=color2, width=width)
def draw_square(x, y, size, color, color2, width):
x1 = x - size/2
y1 = y - size/2
x2 = x + size/2
y2 = y + size/2
canvas.create_rectangle(x1, y1, x2, y2, fill=color, outline=color2, width=width)
def draw_half_circle(x, y, radius, color, start_angle, end_angle, width):
canvas.create_arc(x - radius, y - radius, x + radius, y + radius, start=start_angle, extent=end_angle-start_angle, style=tk.ARC, outline=color, width=width)
draw_face(100, 100, 80, "gray", "black", 2)
draw_square(100, 105, 10, "white", "black", 2)
draw_circle(75, 75, 10, "white", "black", 2)
draw_circle(125, 75, 10, "white", "black", 2)
draw_half_circle(100, 100, 50, "black", 0, -180, 2)
window.mainloop()
Та запусти його.