From: Bruce S. <Bru...@nc...> - 2011-08-11 04:09:18
|
There isn't a true text-editing object in VPython. The closest approximation is this routine found in the documentation on keyboard events: from visual import * prose = label() # initially blank text while True: if scene.kb.keys: # event waiting to be processed? s = scene.kb.getkey() # get keyboard info if len(s) == 1: prose.text += s # append new character elif ((s == 'backspace' or s == 'delete') and len(prose.text)) > 0: prose.text = prose.text[:-1] # erase letter elif s == 'shift+delete': prose.text = '' # erase all text Of course there is also the ability to use Python to accept input that appears in the Python Shell window. Bruce Sherwood On Wed, Aug 10, 2011 at 7:25 PM, Dan Aldrich <dal...@ea...> wrote: > Is there a text box available in visual to allow user to enter data? > I saw the text box, but got the impression it was only for display. > > Thanks, > -d |