Canvas Widget
Canvas widgets implement a box container(a rectangular area) used to draw shapes like
- circles
- line
- polygon etc.
Canvas(master, options.........)
master : master is nothing but the window object (parent window for which Canvas needs to be created )
options : options are used to shape the label separated by comma's and to define action on click. Below is the list of options, can be passed while creating Canvas.
there are few options which may not work on mac, but work finely on windows and linux
Example for the Canvas widget, output screen shot is on top of this post
# program to create canvas widget
try:
from Tkinter import *
except:
from tkinter import *
mw = Tk()
mw.geometry('400x300+10+10')
mw.title("AETies : Automation Expert Technologies")
label = Label(mw, text='Canvas Widget Shapes')
Can = Canvas(mw, bg='#abcdef', height=250, width=250)
coord = 50, 50, 200, 200
arc = Can.create_arc(coord, start=0, extent=359, fill="red")
arc = Can.create_arc(coord, start=0, extent=200, fill="blue")
arc = Can.create_arc(coord, start=0, extent=100, fill="green")
label.pack()
Can.pack()
mw.mainloop()
Comments
Post a Comment