Ответ:
import tkinter as tk
root = tk.Tk()
root.geometry("400x400")
# Рамка для будинку
house_frame = tk.Frame(root, width=300, height=300, bg="gray")
house_frame.place(x=50, y=50)
# Вікна в будинку
window1 = tk.Label(house_frame, width=60, height=60, bg="white")
window1.place(x=75, y=100)
window2 = tk.Label(house_frame, width=60, height=60, bg="white")
window2.place(x=165, y=100)
# Двері в будинку
door = tk.Label(house_frame, width=70, height=120, bg="brown")
door.place(x=115, y=180)
# Димар на даху
chimney = tk.Label(house_frame, width=30, height=60, bg="black")
chimney.place(x=175, y=30)
# Трикутна частина даху
roof = tk.Canvas(house_frame, width=320, height=110, bg="gray", highlightthickness=0)
roof.place(x=40, y=0)
roof.create_polygon(0, 110, 160, 0, 320, 110, fill="red")
root.mainloop()
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
import tkinter as tk
root = tk.Tk()
root.geometry("400x400")
# Рамка для будинку
house_frame = tk.Frame(root, width=300, height=300, bg="gray")
house_frame.place(x=50, y=50)
# Вікна в будинку
window1 = tk.Label(house_frame, width=60, height=60, bg="white")
window1.place(x=75, y=100)
window2 = tk.Label(house_frame, width=60, height=60, bg="white")
window2.place(x=165, y=100)
# Двері в будинку
door = tk.Label(house_frame, width=70, height=120, bg="brown")
door.place(x=115, y=180)
# Димар на даху
chimney = tk.Label(house_frame, width=30, height=60, bg="black")
chimney.place(x=175, y=30)
# Трикутна частина даху
roof = tk.Canvas(house_frame, width=320, height=110, bg="gray", highlightthickness=0)
roof.place(x=40, y=0)
roof.create_polygon(0, 110, 160, 0, 320, 110, fill="red")
root.mainloop()