pythonware.com products ::: library ::: search ::: daily Python-URL!
   

Methods

Back   Next   

 Methods

The Entry widget support the standard Tkinter Widget interface, plus the following methods:

insert(index, text)

Insert text at the given index. Use insert(INSERT, text) to insert text at the cursor, insert(END, text) to append text to the widget.

delete(index), delete(from, to)

Delete the character at index, or within the given range. Use delete(0, END) to delete all text in the widget.

icursor(index)

Move the insertion cursor to the given index. This also sets the INSERT index.

get() => string

Get the current contents of the entry field.

index(index) => index

Return the numerical position corresponding to the given index.

 Selection Methods

selection_adjust(index), select_adjust(index)

Adjust the selection to include also the given character. If index is already selected, do nothing.

selection_clear(), select_clear()

Clear the selection.

selection_from(index), select_from(index)

Starts a new selection. This also sets the ANCHOR index.

selection_present() => flag, select_present() => flag

Returns true (non-zero) if some part of the text is selected.

selection_range(start, end), select_range(start, end)

Explicitly set the selection. Start must be smaller than end. Use selection_range(0, END) to select all text in the widget.

selection_to(index), select_to(index)

Select all text between ANCHOR and the given index.

 Scrolling Methods

These methods are used to scroll the entry widget in various ways. The scan methods can be used to implement fast mouse panning operations (they are bound to the middle mouse button, if available), while the xview method is used with a standard scrollbar widget.

scan_mark(x)

Set the scanning anchor for fast horizontal scrolling to the given mouse coordinate.

scan_dragto(x)

Scroll the widget contents sideways according to the given mouse coordinate. The text is moved 10 times the distance between the scanning anchor and the new position.

xview(index)

Make sure the given index is visible. The widget is scrolled if necessary.

xview_moveto(fraction), xview_scroll(number, what)

Back   Next