I'm using waveshare 5 inch HDMI touchscreen on my raspberry pi , I need a python code to determine the X,Y coordinates of touched point. Do you have any idea ?

1 Answer 1


Your touchscreen works just as every other screen. I suppose you also had to connect an USB cable to your Pi. This acts just like a normal mouse. When you touch your screen, that virtual mouse moves to that point and makes a click there.

You can get the position of the mouse with pyautogui The following code prints the mouse position:

import pyautogui

I hope that helps, otherwise clarify your question or write a comment

  • This link mentions they use GPIO, not USB, for touch events on the 5" screen. Apparently Waveshare's 7" screen does use HID USB.
    – jdonald
    Jul 29, 2019 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.