I am using a small 2.4" touchscreen with a resolution of 320x240 and I am working with pygame to create a GUI. Strangely I am not recording any mouse click between y position 26 and 35.
The problem is not caused by the touchscreen itself. The raspbian desktop works fine. Only with pygame if have this problem. It does not matter if I use the mouse directly, via VNC or the touchscreen.
import pygame
import os
import time
pygame.init()
screen = pygame.display.set_mode((320, 240), pygame.FULLSCREEN)
pygame.mixer.init()
black = pygame.Color( 0, 0, 0)
red = pygame.Color(255, 0, 0)
screen.fill(black)
pygame.display.update()
running = True
while(running):
for event in pygame.event.get():
if event.type is pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
running = False
elif event.type is pygame.MOUSEBUTTONDOWN:
pygame.draw.circle(screen, red, event.pos, 3)
pygame.display.update()
time.sleep(0.1)
pygame.image.save(screen, 'touch.png')
