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

Create successful ePaper yourself

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

textvariableunderlinewidthwraplengthMethods on Button objects:.flash()An instance of StringVar() that is associated withthe text on this button. If the variable is changed,the new value will be displayed on the button.Default is -1, meaning that no character of the textis underlined. If nonnegative, the correspondingtext character will be underlined.Width of the button in letters (if displaying text) orpixels (if displaying an image).If this value is set to a positive number, the text lineswill be wrapped to fit within this length.Causes the button to flash several times between active and normal colors. Leaves thebutton in the state it was in originally. Ignored if the button is disabled..invoke()Calls the button’s callback, and returns what that function returns. Has no effect if thebutton is disabled or there is not callback.5. The Canvas widgetCreates a canvas in the given master window. See the following sections <strong>for</strong> the objectsthat can be created on canvases:.create_arc().create_bitmap().create_image().create_line().create_oval().create_polygon().create_rectangle().create_text().create_window()A slice out of an ellipse.An image as a bitmap.A general image.A line.An ellipse.A polygon.A rectangle.Text annotation.A rectangular window.Because the canvas may be larger than the window, and equipped with scrollbars tomove the overall canvas around in the window, there are two coordinate systems <strong>for</strong>each canvas. The “window coordinates” of a point are relative to the top left corner ofthe area on the display where the canvas appears. The “canvas coordinates” of a pointare relative to the top left corner of the total canvas.w = Canvas ( master, option=value, ... )The constructor returns the new canvas widget. Supported options:bdbgcloseenoughconfineBorder width in pixels. Also borderwidth.Background color of the canvas. Also background.A float that specifies how close the mouse must beto an item to be considered inside it. Default is 1.0.If true (the default), the canvas cannot be scrolledoutside of the scrollregion.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: The Canvas widget Page 11

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

Saved successfully!

Ooh no, something went wrong!