def on_command_move(self, mouse_command=None):
try:
if mouse_command is not None:
mouse_command = mouse_command.strip() # remove the extra white spaces
mouse_command = mouse_command.lower() # Converts into lower Strings
if mouse_command == "left":
self.move_left() # move left function is called
elif mouse_command == "right":
self.move_right() # move right function is called
elif mouse_command == "up":
self.move_up() # move up function is called
elif mouse_command == "down":
self.move_down() # Move down function called
elif mouse_command == "click":
self.on_click_screen() # Clicks the specified location in the Screen
else:
print("Invalid Command Mate!")
return # Returns to the Place where the function was called
except KeyboardInterrupt as Ex:
print("Interrupted by the Keyboard keys :", Ex)
except Exception as Ex:
print("The following Error Occurred", Ex) # this is the Printing of the exception
评论列表
文章目录