1

I am very new to both programming in python and touch interface stuff on the Pi. I have run into an issue I can't seem to resolve by googling:

I have a Sainsmart 7" touch screen that works perfectly in the OS, but as soon as I launch a fullscreen python script using pyQt5, the cursor snaps to the top left corner and no touch works. The mouse still works fine and will move the cursor around as expected.

When I kill the program touch works fine back in the OS.

I have tried replacing my mouseReleaseEvent functions with touchEndEvent and also using an "eventHandler" function... nothing gets it to detect in the program's GUI...

I am not sure if I am supposed to initialize touch somehow. I was under the impression from the documentation that basic "click" behavior in non-touch apps will still work with a touch screen.

Some code examples:

#Separate attempts within a clickable QLabel class that I had working with 
#normal mouseReleaseEvent behavior:

def touchEndEvent(self, event):
    self.setPixmap(self.pixmapA)
    self.clicked.emit(self.objectName())

def event(self, event):
    eventType = event.type() 
    if eventType == QEvent.TouchBegin:
        self.setPixmap(self.pixmapB)
        event.accept()
    elif eventType == QEvent.TouchEnd:
        self.setPixmap(self.pixmapA)
        self.clicked.emit(self.objectName())
        event.accept()
    return True

Any help would be greatly appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.