Re: dogtail About key-stroke in ?



Gautam Ravi wrote:
Hi all,

I am using the dogtail to test my application's behaviour . It is really a cool tool. I thank to all the contributors for this.
I'm glad you're finding it useful!

I have a question to ask too,

I have to include keystrokes in the python script for the keys like,
Up-arrow Key,Down-arrow Key,Function keys like F1 , F5, etc. Can I do this?

Yes, you can do it very easily. Just make sure the correct widget has keyboard focus - Node.grabFocus() can help here in some cases - and then use dogtail.rawinput.pressKey(). Here's an example just to show you some of the functions:

# textEntry is a Node with a roleName of 'text'
textEntry.grabFocus()
rawinput.typeText('Look, I'm typing!\n')
rawinput.pressKey('Up')
rawinput.pressKey('Backspace')
rawinput.pressKey('F1')
rawinput.keyCombo('<Alt>F4')

Zack



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]