A canvas is a rectangular area intended for drawing pictures or other complex layouts. On it you can place graphics, text, widgets, or frames. See the following sections for methods that create objects on canvases:
.create_arc(): A slice out
of an ellipse. See
Section 8.7, “
Canvas arc objects”.
.create_bitmap(): An image
as a bitmap. See
Section 8.8, “
Canvas bitmap objects”.
.create_image(): A graphic
image. See Section 8.9, “
Canvas image objects”.
.create_line(): One or more
line segments. See Section 8.10, “
Canvas line objects”.
.create_oval(): An ellipse;
use this also for drawing circles, which are a special
case of an ellipse. See Section 8.11, “
Canvas oval objects”.
polygon. See Section 8.12, “
Canvas polygon objects”.
rectangle. See Section 8.13, “
Canvas rectangle objects”.
annotation. See Section 8.14, “
Canvas text objects”.
rectangular window. See Section 8.15, “
Canvas window objects”.
To create a
The constructor returns the new
widget. Supported options include:
Canvas widget options
|Width of the border around the outside of the canvas; see Section 5.1, “Dimensions”. The default is two pixels.|
Background color of
the canvas. Default is a light gray, about |
If true (the default), the canvas cannot be
scrolled outside of the |
|Cursor used in the canvas. See Section 5.8, “Cursors”.|
|Size of the canvas in the Y dimension. See Section 5.1, “Dimensions”.|
|Color of the focus highlight when the widget does not have focus. See Section 53, “Focus: routing keyboard input”.|
|Color shown in the focus highlight.|
|Thickness of the focus highlight. The default value is 1.|
The relief style of the canvas. Default is |
A tuple |
|The background color to use displaying selected items.|
||The width of the border to use around selected items.|
||The foreground color to use displaying selected items.|
Normally, focus (see Section 53, “Focus: routing keyboard input”)
will cycle through this widget with the tab key
only if there are keyboard bindings set for it (see
Section 54, “Events” for an overview of
keyboard bindings). If you set this option to 1,
focus will always visit this widget. Set it to
|Size of the canvas in the X dimension. See Section 5.1, “Dimensions”.|
Normally, canvases can be scrolled horizontally to
any position. You can get this behavior by setting
If the canvas is scrollable, set this option to the
Works like |
If the canvas is scrollable, this option should be the