C
C
Cool_Movies2020-09-05 12:30:34
Python
Cool_Movies, 2020-09-05 12:30:34

How to extract data from response?

There is a code

from pyautogui import *

while True:
    print (locateOnScreen('111.png', region = (205, 358, 50, 35)))

In response to
print (locateOnScreen('111.png', region = (205, 358, 50, 35)))

It gives me the answer
Box(left=205, top=358, width=3, height=2)
And here is the question itself, like for example Left=205 Write to a variable for example X
That is, it should be something like this
to take Left from the answer and write to a variable X

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur Pokrovsky, 2020-09-05
@Cool_Movies

It gives me the answer
Box(left=205, top=358, width=3, height=2)

It makes sense, you're converting an object to a string
And here is the question itself, for example, Left=205 Write to a variable, for example X

rect = locateOnScreen('111.png', region = (205, 358, 50, 35))

x = rect.left

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question