From: Akasei Y. <ak...@in...> - 2012-04-27 13:11:19
|
How i can chack if key is pressed? Or when I press arrow Left and arrow Up my "ball" move only in one direction. # -*- coding: UTF-8 -*- > from visual import * > > scene = display( title='Przykład', x=0, y=0, width=640, height=480, > center=( 0, 0, 0 ), background=( 0, 0, 0 ), fov=1.0 ) > ball = sphere( pos=( 0, 0, 0 ), radius=0.5 ) > > scene.autoscale = False > scene.range=( 10, 10, 10 ) > > while True: > if scene.kb.keys: > key = scene.kb.getkey() > if key == 'right': > ball.pos.x += 1 > if key == 'left': > ball.pos.x -= 1 > if key == 'up': > ball.pos.y += 1 > if key == 'down': > ball.pos.y -= 1 > |
From: Akasei Y. <ak...@in...> - 2012-04-27 13:13:04
|
When I press and hold one key (anyone) - there is small pause between first and the rest of events. How to eliminate this? |
From: Anton S. <br...@po...> - 2012-04-27 17:10:45
|
On 2012-4-27 05:46, Akasei Yoshiko wrote: > When I press and hold one key (anyone) - there is small pause > between first and the rest of events. How to eliminate this? On MacOS, System Preferences / Keyboard has a slider for "Delay Until Repeat". To my surprise, I can't find an analogous control on Windows 7. -- Anton Sherwood *\\* www.bendwavy.org *\\* www.zazzle.com/tamfang |
From: Bruce S. <Bru...@nc...> - 2012-04-27 17:30:00
|
It's available on Windows 7. In the Control Panel search box, enter "keyboard", then click on "Keyboard" to get "Keyboard Properties" and change the "Repeat delay" setting. Bruce Sherwood On Fri, Apr 27, 2012 at 11:10 AM, Anton Sherwood <br...@po...> wrote: > On 2012-4-27 05:46, Akasei Yoshiko wrote: >> When I press and hold one key (anyone) - there is small pause >> between first and the rest of events. How to eliminate this? > > On MacOS, System Preferences / Keyboard has a slider for "Delay Until > Repeat". > > To my surprise, I can't find an analogous control on Windows 7. > > -- > Anton Sherwood *\\* www.bendwavy.org *\\* www.zazzle.com/tamfang |
From: Akasei Y. <ak...@in...> - 2012-04-28 10:19:59
|
I doubt that everyone wanted to set up their system according to my recommendations - to properly run the program. Number of events will be increased to handle the keyboard? 2012/4/27 Bruce Sherwood <Bru...@nc...> > It's available on Windows 7. In the Control Panel search box, enter > "keyboard", then click on "Keyboard" to get "Keyboard Properties" and > change the "Repeat delay" setting. > > Bruce Sherwood > > On Fri, Apr 27, 2012 at 11:10 AM, Anton Sherwood <br...@po...> wrote: > > On 2012-4-27 05:46, Akasei Yoshiko wrote: > >> When I press and hold one key (anyone) - there is small pause > >> between first and the rest of events. How to eliminate this? > > > > On MacOS, System Preferences / Keyboard has a slider for "Delay Until > > Repeat". > > > > To my surprise, I can't find an analogous control on Windows 7. > > > > -- > > Anton Sherwood *\\* www.bendwavy.org *\\* www.zazzle.com/tamfang > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |
From: Bruce S. <Bru...@nc...> - 2012-04-27 16:41:24
|
Since your program works normally for me, I'm wondering whether you mean that you expected to get diagonal motion with both keys held down? There isn't currently any way to detect multiple simultaneous keys in VPython (other than combinations with shift, ctrl, or alt, of course). As for the delay before repeating starts, I think that's a feature of most computer systems, intended to prevent unwanted repetition when you finger lingers just a bit too long on a key. You have to hold the key down long enough to convince the operating system that you really do want repetition. Bruce Sherwood On Fri, Apr 27, 2012 at 6:43 AM, Akasei Yoshiko <ak...@in...> wrote: > How i can chack if key is pressed? > Or when I press arrow Left and arrow Up my "ball" move only in one > direction. > > >> # -*- coding: UTF-8 -*- >> from visual import * >> >> scene = display( title='Przykład', x=0, y=0, width=640, height=480, >> center=( 0, 0, 0 ), background=( 0, 0, 0 ), fov=1.0 ) >> ball = sphere( pos=( 0, 0, 0 ), radius=0.5 ) >> >> scene.autoscale = False >> scene.range=( 10, 10, 10 ) >> >> while True: >> if scene.kb.keys: >> key = scene.kb.getkey() >> if key == 'right': >> ball.pos.x += 1 >> if key == 'left': >> ball.pos.x -= 1 >> if key == 'up': >> ball.pos.y += 1 >> if key == 'down': >> ball.pos.y -= 1 > > |