From: Bruce S. <Bru...@nc...> - 2006-12-13 00:18:14
|
This is a serious bug, previously unnoticed (I guess because none of the example programs use keyboard input). Thanks much for reporting it. Apparently scene.kb.keys is not getting set when there's an event. This bug is present in the latest 4.beta11 as well. Bruce Sherwood Chris Lyon wrote: >trying the following example code on windows XP with: > > > >>> import sys > >>> sys.version >'2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]' > >>> import visual > >>> visual.version >(4, 'beta5') > >>> > >The label does not edit....? is this to be expected? > > >prose = label() # initially blank text > >while 1: > > if scene.kb.keys: # is there an event waiting to be processed? > > s = scene.kb.getkey() # obtain keyboard information > > 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 one letter > > elif s == 'shift+delete': > > prose.text = '' # erase all the text > > > > |