Город МОСКОВСКИЙ
00:01:35

Python GUI Tutorial - 17 - Canvas - create rectangle | Tkinter

Аватар
Питон-клуб
Просмотры:
23
Дата загрузки:
02.12.2023 20:17
Длительность:
00:01:35
Категория:
Обучение

Описание

In this video, you'll learn, how we can draw rectangle in tkinter.

to draw a rectangle on canvas we'll use create_rectangle() method of Canvas.

canvas.create_rectangle() takes 4 arguments, first two is for top left corner and second two arguments is for bottom right corner of the rectangle.

we can pass other arguments also like fill = for filling the color , bd = for border, outline= for border color.

example -

from tkinter import *

root = Tk()

canvas = Canvas(width=400, height=400, bg='blue')
canvas.pack()
canvas.create_rectangle(100,100,300,300, fill="yellow", outline="yellow")


root.mainloop()
-------------------

so i'm sure your queries like -
- how we can create rectangle on canvas?
- how to draw rectangle on canvas in tkinter?
- how we can fill the color in rectangle in tkinter canvas?
- how we can change border color of rectangle in tkinter?
- how to change color of outline?

have been solved.


if you have any problem related with this video then please let us know in comment box.
Thanks

Рекомендуемые видео