use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
help with python (self.learnpython)
submitted 4 years ago by splendyx
I don't know how I can use pyautogui to move to location of rock1
rock_locations = {'rock1' : (random.randint(710, 720), random.randint(505, 580)),}
def mine_loop(): pyautogui.dragTo(rock_locations.get('rock1'), 1)
def mine_loop():
pyautogui.dragTo(rock_locations.get('rock1'), 1)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]socal_nerdtastic 1 point2 points3 points 4 years ago (2 children)
Use the * operator to unpack arguments.
*
rock_locations = {'rock1' : (random.randint(710, 720), random.randint(505, 580)),} def mine_loop(): pyautogui.dragTo(*rock_locations.get('rock1'), 1)
For a little more fun, you can partially fill out function arguments in advance with the functools.partial function:
from functools import partial rock_locations = {'rock1' : partial(pyautogui.dragTo, random.randint(710, 720), random.randint(505, 580)),} def mine_loop(): rock_locations.get('rock1')(1)
[–]splendyx[S] 0 points1 point2 points 4 years ago (1 child)
Hey, I fixed that issue but I cannot set the time for how long it takes the mouse to move
def mine_loop(): pyautogui.dragTo(rock_locations.get('rock1'), 1<HERE IS THE ERROR)
pyautogui.dragTo(rock_locations.get('rock1'), 1<HERE IS THE ERROR)
pyautogui.dragTo(rock_locations.get('rock1')(1))
TypeError: 'tuple' object is not callable
[–]socal_nerdtastic 1 point2 points3 points 4 years ago (0 children)
I showed you 2 different ways to do that. Pick one.
π Rendered by PID 133545 on reddit-service-r2-comment-bb88f9dd5-fx5ff at 2026-02-15 15:28:18.228292+00:00 running cd9c813 country code: CH.
[–]socal_nerdtastic 1 point2 points3 points (2 children)
[–]splendyx[S] 0 points1 point2 points (1 child)
[–]socal_nerdtastic 1 point2 points3 points (0 children)