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.

highlightbackgroundhighlightcolorhighlightthicknessrelieftakefocuswidthColor of the focus highlight when the frame doesnot have focus.Color shown in the focus highlight when the framehas the focus.Thickness of the focus highlight.The default relief <strong>for</strong> a frame is FLAT, which meansthe frame will blend in with its surroundings. Toput a border around a frame, set its borderwidthto a positive value and set its relief to one ofRAISED, SUNKEN, GROOVE, or RIDGE.Normally, frame widgets are not visited by inputfocus (see Focus, below, <strong>for</strong> an overview of thistopic). However, you can set this option to 1 ifyou want the frame to receive keyboard input. Tohandle such input, you will need to create bindings<strong>for</strong> keyboard events; see Events, below, <strong>for</strong> more onevents and bindings.The horizontal dimension of the new frame.This will be ignored unless you also call.grid_propagate(0) on the frame.9. The Label widgetLabel widgets can display one or more lines of text in the same style, or a bitmap orimage. To create a label widget in a root window or frame master:w = Label ( master, *options )The constructor returns the label widget. Options include:anchorThis options controls where the text is positionedif the widget has more space than the text needs.The default is CENTER, which centers the text in theavailable space. Suppose the width is set to 10 andthe height is set to 5, and the text occupies onlya 4¢2 area: the anchor option tells <strong>Tkinter</strong> wherein the full area to place that text. Setting it to SWwould put it in the lower left corner, and a value ofE centers it on the right side. Other values includeW, NW, N, NE, and SE. We apologize in advance to ourreaders in the Southern Hemisphere who object tothe assumption that north is up.background The background color of the label area. See thesection on Colors, above. May be abbreviated as"bg".bitmapSet this option equal to a bitmap or image object andthe label will display that graphic. See the sectionson Bitmaps and Images, above.borderwidth Width of the border around the label. Default is 2.cursor Cursor that appears over this label. See Cursors,above.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: The Label widget Page 29

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

Saved successfully!

Ooh no, something went wrong!