Tkinter canvas to add items like line, text , rectangle , oval, polygon, arc and Images with options

Channel Avatar
Comment
X
Share
Tkinter canvas to add items like line, text , rectangle , oval, polygon, arc and Images with options
Tkinter canvas to add items like line, text , rectangle , oval, polygon, arc and Images with options
01:12 declaring canvas
02:30 create_text()Adding text to Canvas
04:30 create_rectangle() adding rectangle to canvas
05:36 create_oval() adding oval ( circle ) to canvas
08:47 create_line() adding line to canvas
09:08 create_line() option arrow
09:58 create_arc() adding arc to canvas
11:38 create_polygon() adding polygon
13:40 create_ploygon() stipple option
15:12 create_image()
16:42 reading jpg image using PIL

We can create canvas to draw various shapes and items like rectable, oval, arc, polygon , line , image etc. There are different options we can use to fill and manage the shape and size of these items.
create

We can declare a canvas in our Tkitner window and place it using grid ( or any other ) layout.
Create_text() can be used to add text by specifying x and y coordinates of the stating point and the font and colour to use.
Create_rectangle() can be used to create rectangles by adding x1,y1 and x2,y2 coordinates
Create_oval() will draw oval shape objects and when square dimensions are given then one circle is created.
Crate_polygon() is used by giving different pairs of x and y coordinates.
Create_image() can be used to add images to the canvas. Here PIL is required to read jpg images.
We can use various options like while creating the items. The line width, line colour, active colour , background , activebackground
We can create animations by using canvas.

https://youtu.be/i7Pv9TWAOAo Tkinter Canvas draw animations using squares and circles
https://youtu.be/je5_tFUQtn8 Tkinter Canvas Sin Cos curves
https://youtu.be/s5ADdoFYN2Y Tkinter Canvas Moving items on screen

https://www.plus2net.com/python/tkinter-canvas.php

#tkinter #python #Canvas #drawingPloygon #drawingLine #drawingRectangle #drawingText #Imageline #textLine

Take the opportunity to connect and share this video with your friends and family if you find it useful.

Keywords: Tkinter, Tkinter canvas, Drawing items on canvas, line by create_line(), text by create_text(), rectangle by create_rectangle(), Oval and circle by create_oval(), Polygon by create_ploygon(), create_image(), adding image, PNG or JPG image on canvas, Options to add fill, width, bg, activedash, dash, active, outline, stipple, state, activefill, activeoutline, activewidth, disabledfill, disabledoutlinestipple, disabledstipple, disabledwidth

Read Also

Leave a Reply

Your email address will not be published. Required fields are marked *