当前位置: 首页>>代码示例>>Python>>正文


Python gesture.GestureDatabase类代码示例

本文整理汇总了Python中kivy.gesture.GestureDatabase的典型用法代码示例。如果您正苦于以下问题:Python GestureDatabase类的具体用法?Python GestureDatabase怎么用?Python GestureDatabase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GestureDatabase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_touch_up

 def on_touch_up(self, touch):
     self.points += [touch.pos]
     gesture = Gesture()
     gesture.add_stroke(self.points)
     gesture.normalize()
     gdb = GestureDatabase()
     print "Gesture:", gdb.gesture_to_str(gesture)
开发者ID:Anhmike,项目名称:kivy-book-examples,代码行数:7,代码来源:gesturerecorder.py

示例2: TabPannel

class TabPannel(TabbedPanel):
    def __init__(self, *args, **kwargs):
        super(TabPannel, self).__init__(*args, **kwargs)
        self.app = RfAttendance.get_running_app()

        self.gdb = GestureDatabase()
        self.left_to_right_gesture = self.gdb.str_to_gesture(left_to_right_gesture)
        self.right_to_left_gesture = self.gdb.str_to_gesture(right_to_left_gesture)

        self.gdb.add_gesture(self.left_to_right_gesture)
        self.gdb.add_gesture(self.right_to_left_gesture)

    def on_touch_down(self, touch):
        touch.ud['line'] = Line(points=(touch.x, touch.y))
        return super(TabPannel, self).on_touch_down(touch)

    def on_touch_move(self, touch):
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return super(TabbedPanel, self).on_touch_move(touch)
        except KeyError:
            pass

    def on_touch_up(self, touch):
        g = Gesture()
        g.add_stroke(list(zip(
            touch.ud['line'].points[::2],
            touch.ud['line'].points[1::2]
        )))
        g.normalize()
        g.name = ''

        g2 = self.gdb.find(g, minscore=0.70)
        if g2 and g2[1] == self.left_to_right_gesture:
            self.switch_to_left()
        elif g2 and g2[1] == self.right_to_left_gesture:
            self.switch_to_right()

        return super(TabPannel, self).on_touch_up(touch)

    def switch_to_right(self):
        current_tab_index = self.tab_list.index(self.current_tab)
        if current_tab_index == 0:
            return

        try:
            self.switch_to(self.tab_list[current_tab_index - 1])
        except IndexError:
            pass

    def switch_to_left(self):
        current_tab_index = self.tab_list.index(self.current_tab)

        try:
            self.switch_to(self.tab_list[current_tab_index + 1])
        except IndexError:
            pass
开发者ID:tehpug,项目名称:RFAttendance,代码行数:57,代码来源:tab_panel.py

示例3: Listener

class Listener(EventDispatcher):
    """
    listener function that queries kivy for touch events, builds the gesture
    and dispatch it through the actions singleton.
    """
    def __init__(self, config, gestures, el, *args, **kwarg):
        """
        :param config: string containing the path to the action configuration
        :param gestures: string containing the path to the gestures configuration
        """
        super(EventDispatcher, self).__init__(*args, **kwarg)
        self._event_loop = el
        self._gdb = GestureDatabase()
        self._actions = Actions(config, gestures)
        self.update_devices()
        self._multitouches = []

    def update_devices(self):
        log.debug('update_devices()')
        context = pyudev.Context()
        for device in context.list_devices(subsystem='input', ID_INPUT_MOUSE=True):
            if device.sys_name.startswith('event'):
                if 'PRODUCT' in device.parent.keys():
                    self._actions.update_gestures(device.parent['PRODUCT'])
        for gest_n, gest_r in self._actions.get_gestures().iteritems():
            for g in gest_r:
                g = self._gdb.str_to_gesture(g)
                g.normalize()
                g.name = gest_n
                self._gdb.add_gesture(g)

    def on_touch_down(self, touch):
        """
        listening function executed at begining of touch event
        builds the gesture
        """
        self._multitouches.append(touch)
        touch.ud['line'] = Line(points=(touch.sx, touch.sy))
        return True

    def on_touch_move(self, touch):
        """
        listening function executed during touch event
        store points of the gesture
        """
        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.sx, touch.sy]
            return True
        except (KeyError), e:
            pass
开发者ID:guyzmo,项目名称:kitt,代码行数:51,代码来源:listener.py

示例4: __init__

    def __init__(self, *args, **kwargs):
        super(TabPannel, self).__init__(*args, **kwargs)
        self.app = RfAttendance.get_running_app()

        self.gdb = GestureDatabase()
        self.left_to_right_gesture = self.gdb.str_to_gesture(left_to_right_gesture)
        self.right_to_left_gesture = self.gdb.str_to_gesture(right_to_left_gesture)

        self.gdb.add_gesture(self.left_to_right_gesture)
        self.gdb.add_gesture(self.right_to_left_gesture)
开发者ID:tehpug,项目名称:RFAttendance,代码行数:10,代码来源:tab_panel.py

示例5: __init__

 def __init__(self, config, gestures, el, *args, **kwarg):
     """
     :param config: string containing the path to the action configuration
     :param gestures: string containing the path to the gestures configuration
     """
     super(EventDispatcher, self).__init__(*args, **kwarg)
     self._event_loop = el
     self._gdb = GestureDatabase()
     self._actions = Actions(config, gestures)
     self.update_devices()
     self._multitouches = []
开发者ID:guyzmo,项目名称:kitt,代码行数:11,代码来源:listener.py

示例6: __init__

    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()

        self.error_sound = SoundLoader.load('error.mp3')
        self.success_sound = SoundLoader.load('success.mp3')

        #Gestures
        for key, ges in gestures.items():
            self.gdb.add_gesture(ges)

        self.sort_letter()
开发者ID:leonardocsantoss,项目名称:kivy-abc,代码行数:12,代码来源:main.py

示例7: __init__

 def __init__(self, **kwargs):   # inicializace
     self.app = kwargs['root']
     self.register_event_type('on_swipe_right')
     self.register_event_type('on_swipe_left')
     super(GestureListener, self).__init__(**kwargs)
     self.gdb = GestureDatabase()
     self.GSTR_SWIPE_LEFT = \
     self.gdb.str_to_gesture('eNqtls2O2jAURvd+EdgU+f7bL0C3lXiAikIEaKYQQabtvH3tC0ITQZtZeJXkU3ycfEdK7vzwcvj1vth1l+Ht3IWvt2Mfw3zbQ1jNjuuf3Sz0WE7LgcJlNbsM59NLdymXHOavvYT5U8jKbwu9VpSV9f3pcBzqslSX5X8s+1bvCj1cn6A+wntZAhiWcRHr9n/qJdVL0pQNjZUIkAzC5cf6/1B2qITdnbe7oRBSxEwSIXJCmkb5a4E9olDEVCBnUGAUsmlWclZuwULvDeGRVSr62BfjNAudRU1YXj1KE5Z3j9aE5d3jQ/dfyikrIEgmzMCRTSZh5OUTtIF5+0RtYF4/SRuY90/WBuYCqI0AdgH8TAAmy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IoYbfVX0ezqfd69axZWjuQKJC3dYgkGp9D3c/Ab86orc=')
     self.gdb.add_gesture(self.GSTR_SWIPE_LEFT)
     self.gdb.add_gesture(self.GSTR_SWIPE_RIGHT)
开发者ID:Smug28,项目名称:Mobile-TetriNET,代码行数:12,代码来源:tetriwidgets.py

示例8: __init__

 def __init__(self, app, **kwargs):  # inicializace pole
     self.app = app
     super(GameMatrix, self).__init__(**kwargs)
     self.coords = []
     self.dpos = (0,0)
     self.colors = []
     self.shape = None
     self.active_color = [.1372,.1372,.1372,1]
     self.inactive_color = [.1372,.1372,.1372,1]
     self.fUpdate = 12*22*"0"
     self.tnetCoords2 = []
     for y in range(51,73):
         for x in range(51,63):
             self.tnetCoords2.append(chr(x)+chr(y))
     self.tnetCoords = []
     for x in range(51,63):
         col = []
         for y in range(51,73):
             col.append((chr(x), chr(y)))
         self.tnetCoords.append(col)
     self.tnetColors = []
     for c in range(33, 48):
         self.tnetColors.append(chr(c))
     self.move = False
     self.orientation = 0
     self.colored = set()
     self.colors = [deepcopy(self.inactive_color), [0,.6,.8,1], [1,.7333333,.2,1], [.6,.8,0,1], [.666666667,.4,.8,1], [1,.266666667,.266666667,1]]
     self.COORDS_SET = set()
     for y in range(int(self.rows)):
         line = []
         for x in range(int(self.cols)):
             box = Box()
             box.coords = (x, y)
             box.colored = deepcopy(self.inactive_color)
             self.add_widget(box)
             line.append(box)
             self.COORDS_SET.add((x, y))
         self.coords.append(line)
     self.b = 0
     self.startgame = False
     self.seed = randint(0,0xFFFFFF)
     self.specials = set()
     self.buildNext = False
     self.mLR = False
     self.gdb = GestureDatabase()
     self.GSTR_DROP = \
     self.gdb.str_to_gesture('eNq1l82O2jAQgO9+Ebg08ng8M/YL0GslHqBKIQK0W4iSbHf37WtPIjZS/6Si4WIYez4P+Yyxt5eny4/35tSN08vQuc9L23u3Pfbg9ptr+73buD6Ut6VBN+434zTcnrqxfIxu+9yT2/4WstdhrueKkpLf3y7Xqaalmpb/kPaljnI9zBXUEt5LCgS3803EKCmwT5yJCXKt5q32Yu31HsETZe85AIAQsBu/tX+fJuo05E7zDEEEBDOg17k8ufH0AF2/O4gRPSk929CDCghgRA9KRyO6Wg13qx7viyaUaRLyY3jVGsQKr15DNsKjikWwwqtZRCu8qkUrtahq0Uotqlpc1H7yDaT1jhbKY3sEH1VtBCu8qo1ohVe1kazwqjaKFV7VRiu1pGrJSi2pWvpQG0Ne/9k+SFezREZ0FUtiRFevlG3orFoZjOhqlY2sslplI6usVtnIKqtV/rC6bPDLCSTBQi89HhIjUvQogcWXn+C/4KJSBWzg6lTQBq5Khf4XXm8Hh6HrrvezvnA97Iu47Q4FG+92UUJppl6Sa38N5nUwogaTXwUxpzkI6yAtwbAOQmnWL64jUEdwriNCWtKia+fqz93ldJ7qHYXcrmyxpbtEXy/H6VyDXIqaQ9PtuRva66FejpLUZQg1vDzWr/1wO74cFJRKJQ2Vs4OUK0sMwEF0gTY/AXq8jUg=')
     self.gdb.add_gesture(self.GSTR_DROP)
     self.dropAnimation2 = Animation(colored=self.inactive_color, d=.03)
     self.dropAnimation = Animation(colored=self.inactive_color, d=.1)
     self.spectate = False
开发者ID:Smug28,项目名称:Mobile-TetriNET,代码行数:51,代码来源:box.py

示例9: GestureListener

class GestureListener(Widget):
    def __init__(self, **kwargs):   # inicializace
        self.app = kwargs['root']
        self.register_event_type('on_swipe_right')
        self.register_event_type('on_swipe_left')
        super(GestureListener, self).__init__(**kwargs)
        self.gdb = GestureDatabase()
        self.GSTR_SWIPE_LEFT = \
        self.gdb.str_to_gesture('eNqtls2O2jAURvd+EdgU+f7bL0C3lXiAikIEaKYQQabtvH3tC0ITQZtZeJXkU3ycfEdK7vzwcvj1vth1l+Ht3IWvt2Mfw3zbQ1jNjuuf3Sz0WE7LgcJlNbsM59NLdymXHOavvYT5U8jKbwu9VpSV9f3pcBzqslSX5X8s+1bvCj1cn6A+wntZAhiWcRHr9n/qJdVL0pQNjZUIkAzC5cf6/1B2qITdnbe7oRBSxEwSIXJCmk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LwzhYCpuSkK4n5JqAaX4n8pX0FGu60sTjspQYeA/ALs+uDxk4TZFmZeSdNc6CPI0js6CEzfQMnvrD/mmsRx4NK5yPV95UJeP7YTc+1QQrCZpLfQmOp5f+vDlu68krpfqIoYbfVX0ezqfd69axZWjuQKJC3dYgkGp9D3c/Ab86orc=')
        self.gdb.add_gesture(self.GSTR_SWIPE_LEFT)
        self.gdb.add_gesture(self.GSTR_SWIPE_RIGHT)
        
    def simplegesture(self, name, point_list):
        # Pomocná funkce pro rozpoznávání gesta
        g = Gesture()
        g.add_stroke(point_list)
        g.normalize()
        g.name = name
        return g
        
    def on_touch_down(self, touch):
        # Při doteku, spustí zaznamenávání
        if self.collide_point(touch.x, touch.y):
            touch.ud["line"] = Line(points=(touch.x, touch.y))
            touch.grab(self)
            print "< grabbed >"
            
    def on_touch_move(self, touch):
        # Při pohybu prstu, zaznamenává pohyb
        if (touch.grab_current is self):
            touch.ud["line"].points += [touch.x, touch.y]
    
    def on_touch_up(self, touch):
        # Při zvednutí prstu, porovnává s gestem v databázi
        if (touch.grab_current is self):
            g = self.simplegesture('', zip(touch.ud['line'].points[::2], touch.ud['line'].points[1::2]))
            g2 = self.gdb.find(g, minscore=0.80)
            if g2:
                if g2[1] == self.GSTR_SWIPE_LEFT:
                    self.dispatch('on_swipe_left')
                if g2[1] == self.GSTR_SWIPE_RIGHT:
                    self.dispatch('on_swipe_right')
            touch.ungrab(self)
    
    def on_swipe_left(self, *args):
        # Událost přejetí prstu doleva
        self.app.on_swipe_left()
    
    def on_swipe_right(self, *args):
        # Událost přejetí prstu doprava
        self.app.on_swipe_right()
开发者ID:Smug28,项目名称:Mobile-TetriNET,代码行数:53,代码来源:tetriwidgets.py

示例10: cGestureBoard

class cGestureBoard(cTouchRectangle):
    ''' base class for recording gestures '''
    def __init__(self, **kwargs):
        super(cGestureBoard, self).__init__(**kwargs)
        self.gdb = GestureDatabase()

    def on_touch_down(self, touch):

        #self.DrawStandardGestures()
        # start collecting points in touch.ud
        # create a line to display the points

        if not self.collide_point(touch.x, touch.y):
            return False
        touch.grab(self)

        userdata = touch.ud
        with self.canvas:
            Color(1, 1, 0)
            d = 10.
            Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))
            userdata['line'] = Line(points=(touch.x, touch.y))
        return True

    def on_touch_move(self, touch):

        if touch.grab_current is not self:
            return

        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return True
        except KeyError:
            pass
        return True

    def on_touch_up(self, touch):

        if touch.grab_current is not self:
            return

        g = simplegesture('',zip(touch.ud['line'].points[::2], touch.ud['line'].points[1::2]))
        # print "gesture representation:", ':',self.gdb.gesture_to_str(g)
        uLogName=oORCA.uGestureLogName

        oLogFile = open(uLogName, 'a')
        oLogFile.write('Gesturecode:'+self.gdb.gesture_to_str(g)+'\n')
        oLogFile.close()
        return True
开发者ID:thica,项目名称:ORCA-Remote,代码行数:50,代码来源:GestureBoard.py

示例11: __init__

 def __init__(self, *args, **kwargs):
     super(DrawingSpace, self).__init__()
     self.gdb = GestureDatabase()
     self.line45 = self.gdb.str_to_gesture(line45_str)
     self.circle = self.gdb.str_to_gesture(circle_str)
     self.cross = self.gdb.str_to_gesture(cross_str)
     self.line135 = self.line45.rotate(90)
     self.line225 = self.line45.rotate(180)
     self.line315 = self.line45.rotate(270)
     self.gdb.add_gesture(self.line45)
     self.gdb.add_gesture(self.line135)
     self.gdb.add_gesture(self.line225)
     self.gdb.add_gesture(self.line315)
     self.gdb.add_gesture(self.circle)
     self.gdb.add_gesture(self.cross)
开发者ID:Anhmike,项目名称:kivy-book-examples,代码行数:15,代码来源:drawingspace.py

示例12: __init__

    def __init__(self, **kwargs):
        super(AppView, self).__init__(**kwargs)          
 
        #internal variables
        self.touches2 = {}
        self.last_touch_id = -1
        #self.translation_allowed = False
        self.gesture_found = False
        self.position_left = True
        self.anim = False #currently animated

        self.set_texture('style/bar/slider-fond.png') 
        
        #add gestures
        self.gdb = GestureDatabase()
        self.create_gesture( [(0,0),(10,0)] )
        self.create_gesture( [(0,0),(-10,0)] )        
开发者ID:triselectif,项目名称:Rongo-Rongo,代码行数:17,代码来源:appview.py

示例13: __init__

 def __init__(self, *args, **kwargs):
     super(GestureBox, self).__init__(*args, **kwargs)
     self.gestures = GestureDatabase()
     self.register_event_type('on_gesture')
开发者ID:buchuki,项目名称:Todoy,代码行数:4,代码来源:gesturebox.py

示例14: GestureDatabase

#!/usr/bin/env python
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

cross = gdb.str_to_gesture(
    'eNq1l9tu3DYQhu/1It6bLjicE+cFtrcF/ACBYwv2Iqkt7G7a5u1DDqlT0lZ7I2Mxsj5JP2f4k'
    'xR1OH85//X9+Npfb98uffd7Ow6hO7wM0D0+vD/92T90Q8z/5gN218eH6+3y8aW/5lPqDl8H7g'
    '7/KvLot3WDFCnNzw8f5/dbeSyVx+w/Hvuj3NUNUDMoKXzPj0DsTuGIGiRJGCOVbP4pV7E7/Ra'
    'ORJZMwhS1u35++v9WyFvh7rU2ENEMJI1RuLu+NnEEgyhpjEG2xb1y0H3Ek4vbKA6kEmyKEWdx'
    'WPaJsaVN8eidH2Ef8ejiOIqHdbeQLvolaLTFLxlty7ulsVlaNBKChCnmEpp+uRSSIozRBLbl3'
    'dSoe8m7rdF2kkc3FmGSB1FVphYT6qSejY2sOsXtyYRuLOIkHgEtGrZIKJP4Spk13ZG524qzrX'
    'FWLlHmfok/9UvcFndTUe8Rz8OVA7RIYXtAoluKdke3hJU42j0dQ24pwV7ybiptm1oGE+Rz4il'
    'u9w25q8R3qQtnZ2WKd+TutpLeox4pZmt1jHlh3VR3X8nuUceFdIm4qc5uKy9mapCY339jXKb+'
    '08tjewlmN5VxH3H3lBcLcASZfzGv4osFPiVk5SnmCb6p766y7qbvvvL0Zg2GKtHGCDjPJ2FKi'
    'cfI2wuNuKsCu2i7qYLzdiP3BXGLYIs1DEAo0hh1eyaJeyq8i7b7KdM26ddNXpPO7SCSTnHbSn'
    'ErxXaQVndSJyeJGQOMMe+RJm1aLrk5bku7kYp7SLuPOvlI6/FHs4+87hH2Fats/p8vff8+beV'
    'Vyl5etTucMA/a7kSE+XAbNHVPmcGK2ZKBsxSciTPUyqAwUmdRKouFCToDqgwLU3MWQmVUmDnD'
    '1O7jwsCfOuXFt0JxGKNDaS1rhVwhV5gqpBW0CnEJLaw0G4QKwwrGmlJaQaxw1bp5QRBsBb2iZ'
    'MvczQtSWjGvx09m5uXwmnk1tNKDEGYbZli94TX0aqg1nRrE5Z3WoFdDtWyFBr0aqR2URljLqa'
    '1bbNDrsToywth69QfqGIrcaDVoPSoBqkNtbDE1Wi3iqsAtV6gesSdL0vKCalLNdqa5rjpB3vr'
    'z69utfJTmz8qTFclM/z6/3N4cSteSyvT28bW/PL0/935Ffdsd1n9Q7muT+dNw+Xj59lzFU+6W'
    'Y5L8ug5qwTR/PFH5bDz+AM/6Dqo=')

circle = gdb.str_to_gesture(
    'eNq1WNtyGzcMfd8fiV+iIS4EyB9QXzuTD+g4icbxpLU1ttI2f18QoHa5jpy12qlGAyUw9hA4B'
    'yQh3dx/vf/z++7u8Hz69nSYfumfxzTdfD7C9OHdw+0fh3fTEe2f9kHT84d3z6enx6+HZ/svTz'
    'e/H/N0cxHkg4dNR2lQas8fH+8fTu2x0h6rrzz2a4uajhAZtBS+2yOA0z7tCDMkqjk1y0W1pfN'
    '3+zNN+/dpl0pGqmdLJcv0/PH25+uwr5Onu74EMxErVLeGMT3fNXQDT4C1kopbLVBhG92LB91G'
    'h6RJinRb5A2ZF8euM/aP5JyxhVVShbBiJW9ho7OPcMZG1YTzWzTP2LgAm8XyBmx0bJqxsfSkm'
    '8UqMzaRluVduW5ju5o4qwkKmFWruM28cGLNcW3eriXOWi5kv8zbNK7GcwmbabtP0LXEWcuB7M'
开发者ID:Alan-FGR,项目名称:kivy,代码行数:31,代码来源:my_gestures.py

示例15: GestureDatabase

gesture_strings = {
    'left_to_right_line': 'eNq1WMtSI0cQvM+PwMVE17vrB9irI/gAB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g1lPk68GooT4YSnK7Eo5oTORBbsHlKwn+CXh1luxK9WsqTpcgqQRxBef/GoRM9O1opQsJEyo5OF+lSPRW8Er2aKnwlenVVJlfBrWdGtnZHCJeJDrmYQtQh233+LnKZXl2VyVXQPtJIQSK7u8pR8od9hEph9fTXLvOrrzL5ClkWL+ZIFJypHvD9JSAxVwwJy26RD8XldaPVWZ2cBYgsUIA4ZTxmWzme4HRP6ZfsJX71Vgdv+/SPFraZl+P8040smKt5OKHQT+CruaojPstK5qSa9SHLLrqIXs1VG+nZXANMsrhJQj+hs6GI5ebFnk06K3qRXq3VONCx7dMebf8jX0Qv1diCI12P9gjVXLGL6NXWMtqKeYABZeXSDkwLc6+ultHV3PFyyaO2viBL6dXVMrpKalYy79wiIk2lZa6W6moZXSXPQMnnKR+XwHzyF9Gtumqjq6f9ajwr/SK8mmqjqcyRlTfAwGKES1OvptpoKhcs2cmQgLLjIF1ckP2rwMP7ZvM6Huyt9Cd7s+52LRh9f50+pVuj4Aq6/da8u59TSFPErEJlFccfS7nDrNygAh1nFVGaguYUWfMzU3KTWwavs/1+jEqFNIV+Brq2KbUpPgWvGeJ0SunlpcrB+yn5Y1JVYU1Rk8oXmDOKVnrQj5fWLHxGHgd5D9RmX8DJYLuXaAUGaYPeBul4MIv0aYJoZQRuimhhcjxoZ24jWuUAP9+GNzujzCqCm8LmFALw2c7weXk5I49ZObb5EWBWQjhIcFbCMEhoXhKDhGcleqDIrKQccpmtudiBUuYlh1zmq+4ySOYr7TZI5qsbQ7o4X90YKJjVbX3sefPy9Lzv/5HQ98J8SUlBDv/z8rh/rqPct5ITlxGll+zfvm3e718fNlUmde/tx4ee+8f2/e3x+0NDaz76K8++nbOA5w4RUU+0q/8AAJ5q8g=='
}

from kivy.uix.boxlayout import BoxLayout
# BEGIN GESTURE_DB
from kivy.gesture import GestureDatabase

gestures = GestureDatabase()
for name, gesture_string in gesture_strings.items():
    gesture = gestures.str_to_gesture(gesture_string)
    gesture.name = name
    gestures.add_gesture(gesture)
# END GESTURE_DB


# BEGIN GESTUREBOX
class GestureBox(BoxLayout):
    def on_touch_down(self, touch):
        touch.ud['gesture_path'] = [(touch.x, touch.y)]
        super(GestureBox, self).on_touch_down(touch)

    def on_touch_move(self, touch):
        touch.ud['gesture_path'].append((touch.x, touch.y))
        super(GestureBox, self).on_touch_move(touch)

    def on_touch_up(self, touch):
        print(touch.ud['gesture_path'])
        super(GestureBox, self).on_touch_up(touch)
开发者ID:DeathscytheH,项目名称:creating_apps_in_kivy,代码行数:31,代码来源:gesture_box.py


注:本文中的kivy.gesture.GestureDatabase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。