MICILE EZ_Touchscreen Documentation
version: 0.9
A few notes about our documentation:
  • The intentions of this documentation are to keep things simple.
  • Please see the examples at the end of each section for concrete examples of how to use each function.
  • If in doubt how to use a function, experiment!
  • We don't believe in writing more words just to make the documentation look more substantial
  • Quick Reference
    Function List
    Compatible Devices
    Capacitive MultiTouch Screen built into every tablet

    * Please contact us for information on adding support for a device.


    Touchscreen Functions
    touchscreen_finger_point()
    Returns a single touch point or None of a finger is not touching the touchscreen.
    If more than one finger is touching, only one finger point is returned.
    The point returned is a dictionary containing an 'x' and 'y' key.
    touchscreen_finger_points_multitouch()
    Returns a list of touch points representing the different fingers currently touching the touchscreen. The order of the points returned is not guaranteed. Each point returned is a dictionary containing an 'x' and 'y' key.

    The difference between this function and
    touchscreen_finger_point is that this function will return all of the points where fingers are touching the touchscreen as opposed to touchscreen_finger_point which will return only one finger point even if multiple fingers are touching the touchscreen. Most touchscreen only support a maximum of four or five touchpoints.
    touchscreen_finger_points_multitouch_all()
    Returns a list representing a time sequence of multitouch points since the last call to touchscreen_finger_point, touchscreen_finger_points_multitouch, or touchscreen_finger_points_multitouch_all.

    The difference between this function and touchscreen_finger_points_multitouch is that touchscreen_finger_points_multitouch will return where the fingers currently are, while this function will return all the places where the fingers have previously been including where the fingers currently are. By traversing the list you can recreate the path that the fingers have moved.

    This example demonstrates how to interface with the touch screen in single point mode. The is the most common use of the touchscreen.
    # --------------------------------------------------
    # touchscreen_single_demo.py
    # --------------------------------------------------
     
    # import the ez_touchscreen library v0.9
    # import the ez_graphics library v0.9
    from ez_touchscreen_09 import *
    from ez_graphics_09 import *
     
    # clear the screen
    clear_screen('black')
    sw = get_screen_width()
    sh = get_screen_height()
    set_color('red')
     
    # main loop
    while True:
        # read a single finger point from the touchscreen
        touch_point = touchscreen_finger_point()
        if touch_point != None:
            # get the x and y coordinates of the touch
            x = touch_point['x']
            y = touch_point['y']
            
            # don't draw past the edge of the screen or we will crash
            if (x > (sw - 10))x = sw - 10
            if (y > (sh - 10))x = sh - 10
            
            # draw a 10 x 10 rectangle where the finger touched
            draw_rect(xy1010)

    Screen Shot

    This example demonstrates how to interface with the touch screen in multitouch mode.
    # --------------------------------------------------
    # touchscreen_multi_demo.py
    # --------------------------------------------------
     
    # import the ez_touchscreen library v0.9
    # import the ez_graphics library v0.9
    from ez_touchscreen_09 import *
    from ez_graphics_09 import *
     
    # clear the screen
    clear_screen('black')
    sw = get_screen_width()
    sh = get_screen_height()
    set_color('green')
     
    # main loop
    while True:
        # read a single finger point from the touchscreen
        touch_points = touchscreen_finger_points_multitouch()
        for point in touch_points:
            # get the x and y coordinates of the touch
            x = point['x']
            y = point['y']
     
            # don't draw past the edge of the screen or we will crash
            if (x > (sw - 10))x = sw - 10
            if (y > (sh - 10))x = sh - 10
     
            # draw a 10 x 10 rectangle where the finger touched
            draw_rect(xy1010)

    Screen Shot

    This example demonstrates how to interface with the touch screen in advanced multitouch mode which shows all points that the touch controller knows about in a time dependent order.
    # --------------------------------------------------
    # touchscreen_all_demo.py
    # --------------------------------------------------
     
    # import the ez_touchscreen library v0.9
    # import the ez_graphics library v0.9
    from ez_touchscreen_09 import *
    from ez_graphics_09 import *
     
    # clear the screen
    clear_screen('black')
    sw = get_screen_width()
    sh = get_screen_height()
    set_color('blue')
     
    # main loop
    while True:
        # read a single finger point from the touchscreen
        list_of_touch_points = touchscreen_finger_points_multitouch_all()
        for touch_points in list_of_touch_points:
            for point in touch_points:
                # get the x and y coordinates of the touch
                x = point['x']
                y = point['y']
        
                # don't draw past the edge of the screen or we will crash
                if (x > (sw - 10))x = sw - 10
                if (y > (sh - 10))x = sh - 10
        
                # draw a 10 x 10 rectangle where the finger touched
                draw_rect(xy1010)

    Screen Shot