22.07.2013 Views

A Comprehensive Introduction to Python Programming and ... - MSDL

A Comprehensive Introduction to Python Programming and ... - MSDL

A Comprehensive Introduction to Python Programming and ... - MSDL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

3.2 The Different Widgets 35 / 75<br />

Method Description<br />

create arc(bbox, options) Creates an arc canvas item <strong>and</strong> returns its item ID.<br />

create bitmap(position, options) Creates a bitmap canvas item <strong>and</strong> returns its item ID.<br />

create image(position, options) Creates an image canvas item <strong>and</strong> returns its item ID.<br />

create line(coords, options) Creates a line canvas item <strong>and</strong> returns its item ID.<br />

create oval(bbox, options) Creates an oval canvas item <strong>and</strong> returns its item ID.<br />

create polygon(coords, options) Creates a polygon canvas item <strong>and</strong> returns its item ID.<br />

create rectangle(coords, options) Creates a rectangle canvas item <strong>and</strong> returns its item ID.<br />

create text(position, options) Creates a text canvas item <strong>and</strong> returns its item ID.<br />

create window(position, options) Places a Tkinter widget in a canvas window item <strong>and</strong><br />

returns its item ID.<br />

delete(items) Deletes all matching items, if any.<br />

itemcget(item, option) Returns the current value for an option from a canvas<br />

item.<br />

itemconfig(item, options),<br />

itemconfigure(item, options) Modifies one or more options for all matching items.<br />

coords(item) Returns a tuple containing the coordinates for the item.<br />

coords(items, x0, y0, x1, y1, . . . , xn, yn) Changes the coordinates for all matching items.<br />

bbox(items),<br />

bbox( ) Returns the bounding box for the given items. If the<br />

specifier is omitted, the bounding box for all items are<br />

returned.<br />

canvasx(screenx),<br />

canvasy(screeny) Converts a window coordinate <strong>to</strong> a canvas coordinate.<br />

tag bind(item, sequence, callback),<br />

tag bind(item, sequence, callback, "+") Adds an event binding <strong>to</strong> all matching items. Using the<br />

“+” option, it adds the binding <strong>to</strong> the previous ones,<br />

otherwise all previous bindings are replaced.<br />

tag unbind(item, sequence) Removes the binding, if any, for the given event sequence<br />

on all the matching items.<br />

type(item) Returns the type of the given item as a string (one of<br />

“arc”, “bitmap”, “image”, “line”, “oval”, “polygon”,<br />

“rectangle”, “text”, “window”).<br />

lift(item),<br />

tkraise(item)<br />

/ lower(item) Moves the given item <strong>to</strong> the <strong>to</strong>p / bot<strong>to</strong>m of the canvas<br />

stack. If multiple items match, they are all moved<br />

while preserving their relative order.<br />

Continued on next page...

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

Saved successfully!

Ooh no, something went wrong!