#๐ I am trying to make an image recognition code, but can't get it done, can someone help?
27 messages ยท Page 1 of 1 (latest)
@wooden cosmos
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.
code is in pinned messages
Which channel?
idk if you can see it, but if you click expand, you might be able to see it
I'm already in full view
#1293478722711846942
whats wrong with it?
it just outputs an error
not exactly the image recognition algorithm I was expecting, sorry couldn't help you with it.
Why get [180] out of that tuple of just 2?
oh... okay, no problem
what
!e
print((123, 456)[0])
print((789, 258)[1])
print((852, 963)[123])
The first 2 will print fine.
The last one will error out
:x: Your 3.12 eval job has completed with return code 1.
001 | 123
002 | 258
003 | Traceback (most recent call last):
004 | File "/home/main.py", line 3, in <module>
005 | print((852, 963)[123])
006 | ~~~~~~~~~~^^^^^
007 | IndexError: tuple index out of range
same error as you
what are you trying to do at this if statement?
its if the pixel on x 815 and y 640 is the color R 180 it click to that spot
you're using it wrong
>>> import pyautogui
>>> pyautogui.pixelMatchesColor(100, 200, (130, 135, 144))
True
>>> pyautogui.pixelMatchesColor(100, 200, (0, 0, 0))
False
well its either that or just the .red part
e.g.
>>> import pyautogui
>>> pix = pyautogui.pixel(100, 200)
>>> pix
RGB(red=130, green=135, blue=144)
>>> pix[0]
130
>>> pix.red
130
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.