-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add touchscreen support #247
Comments
Hi, Sorry that the Mouse documentation is so non-existent - it's generated automatically from the code docstrings using sphinx but somehow it doesn't pick anything up! I will try and fix that. I'm not familiar with the Waveshare touchscreen but the first thing I would do is get that set up so it works OK with normal apps that require a mouse input (such as the desktop). Then I would add mouse click checking to the Minimal.py demo just to check that worked. Something like ...
mouse = pi3d.Mouse()
mouse.start()
last_button = mouse.button_status()
while DISPLAY.loop_running():
sprite.draw()
...
mb = mouse.button_status()
if mb != mouse.BUTTON_UP and mb != last_button: # new click of some kind
print(mb)
last_button = mb
... If that all worked as expected I would add the code to PictureFrame2020: ...
if config.KEYBOARD:
kbd = pi3d.Keyboard()
mouse = pi3d.Mouse() #put this near to the keyboard setup
mouse.start()
last_button = mouse.button_status()
...
text.draw()
mb = mouse.button_status() # put this next to the keyboard checking code
if mb != mouse.BUTTON_UP and mb != last_button:
nexttm = time.time() - 86400.0 # use all the time up for the current slide so the next one starts
last_button = mb
if config.KEYBOARD:
k = kbd.read() You could make it behave differently depending on where you touch the screen (mouse.position() return x,y tuple) Let me know how you get on Paddy |
thanks, this really helps me! |
Hi all,
I tried to find it in the demo files but could not find it.
How can I setup touchsupport for pi3d?
I am currently using the PictureFrame2020.py on a RPI4 4GB with a Waveshare touchscreen.
I would like to be able to go to the next foto on touch
The text was updated successfully, but these errors were encountered: