This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import pyatspi | |
| #Listener pays attention to every press and release | |
| def callback(event): | |
| print ("onKeyPressOrRelease: %s" % (event)) | |
| #This will quit listening if F4 is pressed | |
| if event.event_string=='F4': | |
| pyatspi.Registry.stop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import pyatspi | |
| #Listener pays attention to every press and release | |
| def callback(event): | |
| desktop = pyatspi.Registry.getDesktop(0) | |
| print ("onKeyPressOrRelease: %s" % (event.event_string)) | |
| #This will quit listening if F4 is pressed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import pyatspi | |
| desktop = pyatspi.Registry.getDesktop(0) | |
| # Listener client pays attention to every press and release | |
| def listen(event): | |
| # This will quit listening if F4 is pressed first statement to exit clean | |
| if event.event_string=='F4': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import pyatspi | |
| # Listener client pays attention to every press and release | |
| def listen(event): | |
| # This will quit listening if F4 is pressed | |
| # Must Perform this check first or exit is not clean | |
| if event.event_string=='F4': | |
| pyatspi.Registry.stop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import pyatspi | |
| # Initialise desktop object to the value of the first desktop | |
| desktop = pyatspi.Registry.getDesktop(0) | |
| # Listener client pays attention to every press and release | |
| def listen(event): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import pyatspi | |
| # Initialise desktop object to the value of the first desktop | |
| desktop = pyatspi.Registry.getDesktop(0) | |
| # Listener client pays attention to every press and release | |
| def listen(event): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #method to get the active window | |
| def get_active_window(): | |
| # This will tell us which is the active window | |
| for app in desktop: | |
| for window in app: | |
| return window.getState().contains(pyatspi.STATE_ACTIVE) | |
| #return window |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ^[OS[magpie@localhost examples]$ python Heirarchy-01.py | |
| [desktop frame | main] | |
| [application | gnome-session] | |
| [application | gnome-settings-daemon] | |
| [application | gnome-shell] | |
| [application | evolution-alarm-notify] | |
| [application | abrt] | |
| [application | gedit] | |
| [application | yelp] | |
| [application | gnome-terminal-server] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ->[dialog | Document Statistics] | |
| ->[filler | ] | |
| ->[filler | ] | |
| ->[label | Heirarchy-03.py] | |
| ->[filler | ] | |
| ->[label | ] | |
| ->[panel | ] | |
| ->[label | 0] | |
| ->[label | 0] | |
| ->[label | 0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import pyatspi | |
| def on_key_press(event): | |
| # Must Perform this check first or exit is not clean | |
| if event.event_string=='F4': | |
| pyatspi.Registry.stop() | |
| if event.event_string =='F3': | |
| print_tree(0,active_window()) |