Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

311
Vistas
How to get coordinates of current mouse position in Python?

I want to make a program using Python Turtle, that moves the turtle to mouse coordinates while clicking. But I don't know how to write a function that returns mouse position. Or, if it will be more understandable, there is HTML and JavaScript code to convert into Python code:

function getcoords(event)
{
  console.log(event.clientX + " " + event.clientY);
}

addEventListener("click", getcoords)
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

According to this answer, you can use the code below:

canvas = turtle.getcanvas()
x, y = canvas.winfo_pointerx(), canvas.winfo_pointery()
about 4 years ago · Juan Pablo Isaza Denunciar

0

The Python logic is pretty much the same as your Javascript logic:

from turtle import Screen

def getcoords(x, y):
    print(x, y)

screen = Screen()

screen.onclick(getcoords)

screen.mainloop()
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda