Canvas line objects

In general, a line can consist of any number of segments connected end to end, and each segment can be straight or curved. To create a canvas line object on a canvas C, use id C.create_line ( x0, y0, x1, y1, , xn, yn, option, ) The line goes through the series of points (x0, y0), (x1, y1), (xn, yn). Options include These options specify the dash, fill, stipple, and width values to be used when the line is active, that is, when the mouse is over it. The default is for the line to have no...

The Canvas widget

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 7.7, Canvas arc objects (p. 26). .create_bitmap() An image as a bitmap. See Section 7.8, Canvas bitmap objects (p. 28). .create_image() A graphic image. See Section 7.9, Canvas image objects (p. 29). .create_line() One or more line...

The Scale widget

Tkinter Scale Widget

The purpose of a scale widget is to allow the user to set some integer or float value within a specified range. Here are two scale widgets, one horizontal and one vertical Each scale displays a slider that the user can drag along a trough to change the value. In the figure, the first slider is currently at -0.38 and the second at 7. You can drag the slider to a new value with mouse button 1. If you click button 1 in the trough, the slider will move one increment in that direction per click....

The Paned Window widget

The purpose of the PanedWindow widget is to give the application's user some control over how space is divided up within the application. A PanedWindow is somewhat like a Frame it is a container for child widgets. Each PanedWindow widget contains a horizontal or vertical stack of child widgets. Using the mouse, the user can drag the boundaries between the child widgets back and forth. You may choose to display handles within the widget. A handle is a small square that the user can drag with the...

Canvas rectangle objects

Each rectangle is specified as two points x0, y0 is the top left corner, and x1, y1 is the location of the pixel just outside of the bottom right corner. For example, the rectangle specified by top left corner 100,100 and bottom right corner 102,102 is a square two pixels by two pixels, including pixel 101,101 but not including 102,102 . The outline lies inside the rectangle on its top and left sides, but outside the rectangle on its bottom and right side. The default appearance is a...

The tkMessage Box dialogs module

Once you import the tkMessageBox module, you can create any of these seven common types of popup menu by calling functions from this table. .askokcancel titZe, message, options .askquestion title, message, options Ask for a date one more time .askretrycancel title, message, options Can you cut down a tree 4f- with a herring showinfo X yThis is an ex-parrot. Your brain may not be the boss .showwarning title, message, options In each case, the title is a string to be displayed in the top of the...

Canvas polygon objects

As displayed, a polygon has two parts its outline and its interior. Its geometry is specified as a series of vertices x0, y0 , x1, y1 , xn, yn , but the actual perimeter includes one more segment from xn, yn back to x0, y0 . In this example, there are five vertices id C.create_polygon x0, y0, x1, y1, , option, The constructor returns the object ID for that object. Options These options specify the appearance of the polygon when it is in the ACTIVE state, that is, when the mouse is over it. For...

The Spinbox widget

Tkinter Scrollbar

The Spinbox widget allows the user to select values from a given set. The values may be a range of numbers, or a fixed set of strings. On the screen, a Spinbox has an area for displaying the current values, and a pair of arrowheads. The user can click the upward-pointing arrowhead to advance the value to the next higher value in sequence. If the value is already at maximum, you can set up the widget, if you wish, so that the new value will wrap around to the lowest value. The user can click the...

Canvas oval objects

Ovals, mathematically, are ellipses, including circles as a special case. The ellipse is fit into a rectangle defined by the coordinates x0, y0 of the top left corner and the coordinates x1, y1 of the bottom right corner The oval will coincide with the top and left-hand lines of this box, but will fit just inside the bottom and right-hand sides. To create an ellipse on a canvas C, use id C.create_oval x0, y0, x1, y1, option, which returns the object ID of the new oval object on canvas C....

Paned Window child configuration options

Each child of a PanedWindow has a set of configuration options that control its position and appearance. These options can be provided when a child is added with the .add method, or set with the .pan-econfig method, or queried with the .panecget methods described above. Normally, when you .add a new child to a PanedWindow, the new child is added after any existing child widgets. You may instead use the after w option to insert the new widget at a position just after an existing child widget w....