Touchpad operations

Does wxpython support non-mouse touchpad operations like pinch-zoom? If so, is there an example posted anywhere. ChatGPT generated some code using wx.EVT_TOUCH_BEGIN, but that const is not recognized (or anything starting with wx.EVT_TOUCH.

To be clear, I have a touch pad, but not a touch screen, if that makes any difference.

I notice the docs for the wx.Window class include an EnableTouchEvents() method which refers to wx.TOUCH_ZOOM_GESTURE. The method returns True if the specified events were enabled or False if the current platform doesn’t support touch events.

However, it doesn’t say which binder object you need to use to actually bind the events, but there is a EVT_GESTURE_ZOOM

That’s more than I knew this morning so thanks. I’ll see what I cn do with that.

I just tried a quick hack:

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        self.SetSize((400, 300))
        self.SetTitle("Test Touchpad")
        self.panel = wx.Panel(self, wx.ID_ANY)

        if self.panel.EnableTouchEvents(wx.TOUCH_ZOOM_GESTURE):
            print("Touch enabled")
            self.panel.Bind(wx.EVT_GESTURE_ZOOM, self.OnZoom)

    def OnZoom(self, event):

if __name__ == '__main__':
    app = wx.App()
    frame = MyFrame(None)

It didn’t respond on my Linux laptop, but it did work on my MacBook Pro.

Thanks for the sample. It printed “Touch enabled” so it looks like what I want is at least possible on my Wndows 11 machine.

I’m not sure about that, as my Linux Desktop PC which doesn’t have a touchpad also printed “Touch enabled” ?

That may be the case here as well as I get no response from the event handler.