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.

to the discussion of the associated widget to find out the exact amount that theseactions move the view. The user can drag the slider with B1 or B2 (the middle button) to move the view. For a horizontal scrollbar, clicking B1 in the trough to the left of the slider moves theview left by a page, and clicking B1 in the trough to the right of the slider moves theview a page to the right. For a vertical scrollbar, the corresponding actions movethe view a page up or down. Clicking B2 anywhere along the trough moves the slider so that its left or top end isat the mouse, or as close to it as possible.To create a new scrollbar widget as the child of a root window or frame master:w = Scrollbar ( master, *options )The constructor returns the new scrollbar widget. Options <strong>for</strong> scrollbars include:activebackground The color of the slider and arrowheads when themouse is over them.backgroundThe color of the slider and arrowheads when themouse is not over them. May be abbreviated as bg.borderwidthThe width of the 3-d borders around the entireperimeter of the trough, and also the width of the3-d effects on the arrowheads and slider. Default isno border around the trough, and a 2-pixel borderaround the arrowheads and slider. May be abbreviatedas bd.commandA procedure to be called whenever the scrollbar ismoved. See below <strong>for</strong> a discussion of the callingsequence.cursorThe cursor that appears when the mouse is over thescrollbar. See Cursors, above.elementborderwidth The width of the borders around the arrowheadsand slider. The default is -1, which means to usethe value of the borderwidth option.highlightbackground The color of the focus highlight when the scrollbardoes not have focus. See Focus, below.highlightcolor The color of the focus highlight when the scrollbarhas the focus. See Focus, below.highlightthickness The thickness of the focus highlight. Default is 1.Set to 0 to suppress display of the focus highlight.See Focus, below.jumpThis option controls what happens when a userdrags the slider. Normally (jump=0), every smalldrag of the slider causes the command callback to becalled. If you set this option to 1, the callback isn’tcalled until the user releases the mouse button.orientSet this option to HORIZONTAL <strong>for</strong> a horizontalscrollbar, VERTICAL <strong>for</strong> a vertical one.repeatdelayThis option controls how long button 1 has to beheld down in the trough be<strong>for</strong>e the slider startsmoving in that direction repeatedly. Default is 300,and the units are milliseconds.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: The Scrollbar widget Page 47

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

Saved successfully!

Ooh no, something went wrong!