#πŸ”’ Question about pyautogui

4 messages Β· Page 1 of 1 (latest)

hasty ether
#

Hello,
I have recently started using the pytautogui library and I have tried to create a bot for the google dinosaur game, and it works at the start but it can't reach high points and I don't know if it's because the library is just not fast enough to process the information or it's a thing of my code or pc, could someone please explain this to me and tell me if I should change something in my code??
here is my code:

import pyautogui
import keyboard
import time

def press_space():
pyautogui.keyDown("space")
time.sleep(0.2)
pyautogui.keyUp("space")

time.sleep(2)
pyautogui.PAUSE = 0

while not keyboard.is_pressed("q"):
bg_color = pyautogui.pixel(200, 300)
pos1 = pyautogui.pixel(790, 285)
pos2 = pyautogui.pixel(790, 315)

if pos1 != bg_color or pos2 != bg_color:
    press_space()
night girderBOT
#

@hasty ether

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

night girderBOT
#

@hasty ether

Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.