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

Recommended Answers

All 2 Replies

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.

what do you mean by that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.