COMP Python Tkinter Canvas Nts2
COMP Python Tkinter Canvas Nts2
Canvas
The canvas widget is used to add the
structured graphics to the python application.
It is used to draw the graph and plots to the 7. relief
python application. The syntax to use the It represents the type of the border.
canvas is given below. The possible values are SUNKEN, RAISED,
GROOVE, and RIDGE.
SYNTAX
8. scrollregion
1. w = canvas(parent, options)
It represents the coordinates specified
A list of possible options is given below.
as the tuple containing the area of the
1. bd canvas.
1
8. c = Canvas(top,bg = "pink",height =
"200",width = 200)
9.
10. arc = c.create_arc((5,10,150,200),start
= 0,extent = 150, fill= "white")
11.
EXAMPLES 12. c.pack()
13.
1. from tkinter import * 14. top.mainloop()
2.
3. top = Tk() Output:
4.
5. top.geometry("200x200")
6.
7. #creating a simple canvas
8. c = Canvas(top,bg = "pink",height =
"200")
9.
10.
11. c.pack()
12.
13. top.mainloop()
Output:
Creating an Arc