| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="node731.html" /> |
| 13 | <link rel="prev" href="node729.html" /> |
| 14 | <link rel="parent" href="node722.html" /> |
| 15 | <link rel="next" href="node731.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>16.1.6.8 The index Parameter</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="16.1.6.7 Bindings and Events" |
| 25 | href="node729.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="16.1.6 Handy Reference" |
| 28 | href="node722.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="16.1.6.9 Images" |
| 31 | href="node731.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="node729.html">16.1.6.7 Bindings and Events</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="node722.html">16.1.6 Handy Reference</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="node731.html">16.1.6.9 Images</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H3><A NAME="SECTION0018168000000000000000"> |
| 56 | 16.1.6.8 The index Parameter</A> |
| 57 | </H3> |
| 58 | <P> |
| 59 | A number of widgets require``index'' parameters to be passed. These |
| 60 | are used to point at a specific place in a Text widget, or to |
| 61 | particular characters in an Entry widget, or to particular menu items |
| 62 | in a Menu widget. |
| 63 | |
| 64 | <P> |
| 65 | <DL> |
| 66 | <DT><STRONG>Entry widget indexes (index, view index, etc.)</STRONG></DT> |
| 67 | <DD>Entry widgets have options that refer to character positions in the |
| 68 | text being displayed. You can use these <tt class="module"><a href="module-Tkinter.html">Tkinter</a></tt> functions |
| 69 | to access these special points in text widgets: |
| 70 | |
| 71 | <P> |
| 72 | <DL> |
| 73 | <DT><STRONG>AtEnd()</STRONG></DT> |
| 74 | <DD>refers to the last position in the text |
| 75 | |
| 76 | <P> |
| 77 | </DD> |
| 78 | <DT><STRONG>AtInsert()</STRONG></DT> |
| 79 | <DD>refers to the point where the text cursor is |
| 80 | |
| 81 | <P> |
| 82 | </DD> |
| 83 | <DT><STRONG>AtSelFirst()</STRONG></DT> |
| 84 | <DD>indicates the beginning point of the selected text |
| 85 | |
| 86 | <P> |
| 87 | </DD> |
| 88 | <DT><STRONG>AtSelLast()</STRONG></DT> |
| 89 | <DD>denotes the last point of the selected text and finally |
| 90 | |
| 91 | <P> |
| 92 | </DD> |
| 93 | <DT><STRONG>At(x<big>[</big>, y<big>]</big>)</STRONG></DT> |
| 94 | <DD>refers to the character at pixel location <var>x</var>, <var>y</var> (with |
| 95 | <var>y</var> not used in the case of a text entry widget, which contains a |
| 96 | single line of text). |
| 97 | </DD> |
| 98 | </DL> |
| 99 | |
| 100 | <P> |
| 101 | </DD> |
| 102 | <DT><STRONG>Text widget indexes</STRONG></DT> |
| 103 | <DD>The index notation for Text widgets is very rich and is best described |
| 104 | in the Tk man pages. |
| 105 | |
| 106 | <P> |
| 107 | </DD> |
| 108 | <DT><STRONG>Menu indexes (menu.invoke(), menu.entryconfig(), etc.)</STRONG></DT> |
| 109 | <DD><P> |
| 110 | Some options and methods for menus manipulate specific menu entries. |
| 111 | Anytime a menu index is needed for an option or a parameter, you may |
| 112 | pass in: |
| 113 | |
| 114 | <UL> |
| 115 | <LI>an integer which refers to the numeric position of the entry in |
| 116 | the widget, counted from the top, starting with 0; |
| 117 | </LI> |
| 118 | <LI>the string <code>'active'</code>, which refers to the menu position that is |
| 119 | currently under the cursor; |
| 120 | </LI> |
| 121 | <LI>the string <code>"last"</code> which refers to the last menu |
| 122 | item; |
| 123 | </LI> |
| 124 | <LI>An integer preceded by <code>@</code>, as in <code>@6</code>, where the integer is |
| 125 | interpreted as a y pixel coordinate in the menu's coordinate system; |
| 126 | </LI> |
| 127 | <LI>the string <code>"none"</code>, which indicates no menu entry at all, most |
| 128 | often used with menu.activate() to deactivate all entries, and |
| 129 | finally, |
| 130 | </LI> |
| 131 | <LI>a text string that is pattern matched against the label of the |
| 132 | menu entry, as scanned from the top of the menu to the bottom. Note |
| 133 | that this index type is considered after all the others, which means |
| 134 | that matches for menu items labelled <code>last</code>, <code>active</code>, or |
| 135 | <code>none</code> may be interpreted as the above literals, instead. |
| 136 | </LI> |
| 137 | </UL> |
| 138 | </DD> |
| 139 | </DL> |
| 140 | |
| 141 | <P> |
| 142 | |
| 143 | <DIV CLASS="navigation"> |
| 144 | <div class='online-navigation'> |
| 145 | <p></p><hr /> |
| 146 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 147 | <tr> |
| 148 | <td class='online-navigation'><a rel="prev" title="16.1.6.7 Bindings and Events" |
| 149 | href="node729.html"><img src='../icons/previous.png' |
| 150 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 151 | <td class='online-navigation'><a rel="parent" title="16.1.6 Handy Reference" |
| 152 | href="node722.html"><img src='../icons/up.png' |
| 153 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 154 | <td class='online-navigation'><a rel="next" title="16.1.6.9 Images" |
| 155 | href="node731.html"><img src='../icons/next.png' |
| 156 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 157 | <td align="center" width="100%">Python Library Reference</td> |
| 158 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 159 | href="contents.html"><img src='../icons/contents.png' |
| 160 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 161 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 162 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 163 | <td class='online-navigation'><a rel="index" title="Index" |
| 164 | href="genindex.html"><img src='../icons/index.png' |
| 165 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 166 | </tr></table> |
| 167 | <div class='online-navigation'> |
| 168 | <b class="navlabel">Previous:</b> |
| 169 | <a class="sectref" rel="prev" href="node729.html">16.1.6.7 Bindings and Events</A> |
| 170 | <b class="navlabel">Up:</b> |
| 171 | <a class="sectref" rel="parent" href="node722.html">16.1.6 Handy Reference</A> |
| 172 | <b class="navlabel">Next:</b> |
| 173 | <a class="sectref" rel="next" href="node731.html">16.1.6.9 Images</A> |
| 174 | </div> |
| 175 | </div> |
| 176 | <hr /> |
| 177 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 178 | </DIV> |
| 179 | <!--End of Navigation Panel--> |
| 180 | <ADDRESS> |
| 181 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 182 | </ADDRESS> |
| 183 | </BODY> |
| 184 | </HTML> |