I'm trying to have my mouse click randomly along a bar within a program to set data. I'm not sure how to do it. I have tried setting a box inside the leftClick at the bottom but that unsurprisingly didn't work. I'm very new to python and I'm doing this for an aerospace engineering class I'm taking.
from PIL import ImageGrab
import os
import time
import win32api, win32con
import random
# Globals
# ----------------
x_pad = 14
y_pad = 70
def screenGrab():
box = (x_pad+1,y_pad+1,x_pad+1508,y_pad+258)
im = ImageGrab.grab(box)
im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) + '.png', 'PNG')
def main():
screenGrab()
if __name__ == '__main__':
main()
"""
Omitted code not necessary for this part
"""
def get_cords():
x,y = win32api.GetCursorPos()
x = x - x_pad
y = y - y_pad
def startGame():
#location of first bar
mousePos((33,125))
leftClick(