r/learnpython • u/soncannon7 • Aug 24 '26
how to make my code work in minecraft
dont question my code too much, i just started python and watched a 1 hour coding with mosh video to understand some of the basics.
all it does is move my mouse around while i hold g. but it doesnt work when i go into minecraft, and i assume, any program that locks my mouse.
what do i do?
import random
import keyboard
import pyautogui
import pyscreeze
from pyautogui import mouseInfo, click
while True:
if keyboard.is_pressed('g'):
pyautogui.moveTo(random.randint(0, 2600), random.randint(0, 2600))
if keyboard.is_pressed('q'):
break