[BangPypers] Using dogtail to test/automate gtk apps

Srijayanth Sridhar srijayanth at gmail.com
Wed Jul 29 09:07:08 CEST 2009


Hello,

I am trying to use dogtail to make a demonstration about automating tests
for certain gtk applications we develop. I managed to get a fair bit of it
working but I am having a hard time getting dogtail to send events to
certain types of widgets, primarily the EventBox widget.

I've googled and not found anything significant. Has anyone worked on this?
I am pasting some code.

# This program draws a simple window with an event box in it. The
# eventbox is attached to the on_evbox_clicked() function and prints
# a simple message upon being clicked.

import pygtk
pygtk.require('2.0')
import atk
import gtk

def on_evbox_clicked(evbox,event):
        print "Simple click event"

evbox = gtk.EventBox()
evbox.connect("button-release-event",on_evbox_clicked)
evbox_acc = evbox.get_accessible()
evbox_acc.set_name("test event box")
window = gtk.Window()
window.add(evbox)
window.connect("delete-event",gtk.main_quit)
window_acc = window.get_accessible()
window_acc.set_name("test window")
window_acc.set_role(atk.ROLE_WINDOW)
window.show_all()
gtk.main()

# end of eventbox.py

--------------------------------------------

from dogtail.utils import run
from dogtail import tree
from os import environ,path,remove

app=tree.root.application('eventbox.py')
evbox=app.child("test event box")
print evbox.actions

# actions are showing up as an empty dict. :(

----------------------------------

So for some vague reason the eventbox has no actions associated with it.

Does anyone have a clue why this is so?

Thank you,

Jayanth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090729/51cbedaf/attachment.htm>


More information about the BangPypers mailing list