28.10.2021 Views

Python Tutorial ( PDFDrive )

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

top.mainloop()

When the above code is executed, it produces the following result:

Canvas

The Canvas is a rectangular area intended for drawing pictures or other complex layouts. You can place graphics,

text, widgets or frames on a Canvas.

Syntax:

Here is the simple syntax to create this widget:

w = Canvas ( master, option=value, ... )

Parameters:

• master: This represents the parent window.

• options: Here is the list of most commonly used options for this widget. These options can be used as keyvalue

pairs separated by commas.

Option

Description

Bd Border width in pixels. Default is 2.

Bg

Confine

Cursor

Height

Highlightcolor

Relief

Scrollregion

Normal background color.

If true (the default), the canvas cannot be scrolled outside of the scrollregion.

Cursor used in the canvas like arrow, circle, dot etc.

Size of the canvas in the Y dimension.

Color shown in the focus highlight.

Relief specifies the type of the border. Some of the values are SUNKEN, RAISED,

GROOVE, and RIDGE.

A tuple (w, n, e, s) that defines over how large an area the canvas can be scrolled, where w

is the left side, n the top, e the right side, and s the bottom.

TUTORIALS POINT

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!