12.07.2015 Views

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

.focus ( tagOrId=None )Moves the focus to the object specified by tagOrId. If there are multiple such objects,moves the focus to the first one in the display list that allows an insertion cursor. If thereare no qualifying items, or the canvas does not have focus, focus does not move.If the argument is omitted, returns the ID of the object that has focus, or "" if none ofthem do..gettags ( tagOrId )If tagOrId is an object ID, returns a list of all the tags associated with that object. If theargument is a tag, returns all the tags <strong>for</strong> the lowest object that has that tag..icursor ( tagOrId, index )Assuming that the selected item allows text insertion and has the focus, sets the insertioncursor to index, which may be either an integer index or the string "end". Has no effectotherwise..index ( tagOrId, index )Returns the integer index of the given index in the object specified by tagOrId (thelowest one that allows text insertion, if tagOrId specifies multiple objects). The indexargument is an integer or the string "end"..insert ( tagOrId, be<strong>for</strong>eThis, string )Inserts the given string in the object or objects specified by tagOrId, be<strong>for</strong>e indexbe<strong>for</strong>ethis (which can be an integer or the string "end")..itemcget ( tagOrId, option )Returns the value of the given configuration option in the selected object (or the lowestobject if tagOrId specifies more than one). This is similar to the .cget() method <strong>for</strong><strong>Tkinter</strong> objects..itemconfigure ( tagOrId, options=None )If the options argument is omitted, returns a dictionary whose keys are the options ofthe object specified by tagOrId (the lowest one, if tagOrId specifies multiple objects).To change the configuration option of the specified item, supply one or more keywordarguments of the <strong>for</strong>m option=value..move ( tagOrId, xAmount, yAmount )Moves the items specified by tagOrId by adding xAmount to their x coordinates andyAmount to their y coordinates..postscript ( options )Generates an Encapsulated PostScript representation of the canvas’s current contents.The options include:colormode Use "color" <strong>for</strong> color output, "gray" <strong>for</strong>grayscale, or "mono" <strong>for</strong> black and white.fileIf supplied, names a file where the PostScript willbe written. If this option is not given, the PostScriptis returned as a string.heightHow much of the Y size of the canvas to print.Default is all.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: The Canvas widget Page 15

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

Saved successfully!

Ooh no, something went wrong!