@@ -28,9 +28,9 @@ def __init__(self, parent = None, **kw):
2828 ('state' , NORMAL , None ),
2929 ('entryFont' , None , INITOPT ),
3030 ('width' , 10 , self .setup ),
31- ('numLines' , 5 , self .setup ),
31+ ('numLines' , 1 , self .setup ),
3232 ('focus' , 0 , self .setFocus ),
33- ('cursorKeys' , 0 , self .setCursorKeysActive ),
33+ ('cursorKeys' , 1 , self .setCursorKeysActive ),
3434 ('obscured' , 0 , self .setObscureMode ),
3535 # Setting backgroundFocus allows the entry box to get keyboard
3636 # events that are not handled by other things (i.e. events that
@@ -162,3 +162,22 @@ def enterText(self, text):
162162 """ sets the entry's text, and moves the cursor to the end """
163163 self .set (text )
164164 self .setCursorPosition (len (self .get ()))
165+
166+ def getBounds (self , state = 0 ):
167+ # Compute the width and height for the entry itself, ignoring
168+ # geometry etc.
169+ lineHeight = self .onscreenText .textNode .getLineHeight ()
170+ numLines = self ['numLines' ]
171+ width = self ['width' ]
172+ self .ll .set (0.0 , 0.0 , - 0.3 * lineHeight - (lineHeight * (numLines - 1 )));
173+ self .ur .set (width , 0.0 , lineHeight * 1.3 );
174+
175+ # Scale bounds to give a pad around graphics. We also want to
176+ # scale around the border width.
177+ pad = self ['pad' ]
178+ borderWidth = self ['borderWidth' ]
179+ self .bounds = [self .ll [0 ] - pad [0 ] - borderWidth [0 ],
180+ self .ur [0 ] + pad [0 ] + borderWidth [0 ],
181+ self .ll [2 ] - pad [1 ] - borderWidth [1 ],
182+ self .ur [2 ] + pad [1 ] + borderWidth [1 ]]
183+ return self .bounds
0 commit comments