954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help in controlling mouse click in python

i need help in controlling mouse click in python. Example would be 'clicking File menu --> Save Us--> Save' on its own.

I have this code for launching an app, for example a textfile. but i dont know how to control its mouse click. Advice please.

import os

class LaunchApp:
   
   def launch(self):
      os.system("open "+ "/Applications/TextEdit.app")


go = LaunchApp()
go.launch()


i tried making my own code.. but it does not work

if line.find(phase1) != -1:											
	
		while 1:
			try :
				parent = winDoc.tool_bars[1].groups[3].menu_buttons[1]	
				parent.value.get()
				sleep(0.1)				
				ph.buttonClick(winDoc, 4)								
			
			except :
				break

		parent = winDoc													
		root = parent

Thanks

bettersaid
Light Poster
34 posts since Jul 2010
Reputation Points: 10
Solved Threads: 2
 

Since you are running an app outside of the Python environment, via os.system, the mouse is controlled by the external app that you are running.

woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714
 

what do you mean by that?

bettersaid
Light Poster
34 posts since Jul 2010
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: