Canvas inside a frame : Canvas « GUI Tk « Python

Canvas inside a frame

Canvas inside a frame

from Tkinter import *

class AllTkinterWidgets:
    def __init__(self, master):
        frame = Frame(master, width=500, height=400, bd=1)

        iframe5 = Frame(frame, bd=2, relief=RAISED)
        iframe5.pack(expand=1, fill=X, pady=10, padx=5)
        c = Canvas(iframe5, bg='white', width=340, height=100)
        for i in range(25):
            c.create_oval(5+(4*i),5+(3*i),(5*i)+60,(i)+60, fill='gray70')
        c.create_text(260, 80, text='Canvas', font=('verdana', 10, 'bold'))
        iframe5.pack(expand=1, fill=X, pady=10, padx=5)

root = Tk()
#root.option_add('*font', ('verdana', 10, 'bold'))
all = AllTkinterWidgets(root)
root.title('Tkinter Widgets')

Related examples in the same category

1.Canvas: Simple plotCanvas: Simple plot
2.Bound Scale action with a canvasBound Scale action with a canvas
3.Use canvas to draw line, oval, rectangle, bitmap and arc
4.Bind mouse click action to the object on a canvasBind mouse click action to the object on a canvas
5.Bind action to canvasBind action to canvas
6.Use mouse to draw a shape on canvasUse mouse to draw a shape on canvas
7.Image canvasImage canvas