Skip to main content
TapKit provides two types of swipe gestures: flick for quick swipes and pan for controlled scrolling.

Flick

A quick swipe gesture, like scrolling through a feed:
# Flick up from center (scroll down)
phone.flick(phone.screen.center, direction="up")

# Flick down (scroll up)
phone.flick(phone.screen.center, direction="down")

# Flick left (next page)
phone.flick(phone.screen.center, direction="left")

# Flick right (previous page)
phone.flick(phone.screen.center, direction="right")

Parameters

ParameterTypeOptionsDescription
pointtuple/Point-Starting point for the flick
directionstr"up", "down", "left", "right"Direction to flick

Use Cases

  • Scrolling through lists or feeds
  • Swiping between pages
  • Dismissing notifications
  • Navigating carousels

Pan

A slower, more controlled scroll gesture:
# Slow scroll down (500ms default)
phone.pan(phone.screen.center, direction="up", duration_ms=500)

# Very slow scroll
phone.pan(phone.screen.center, direction="up", duration_ms=1000)

# Quick scroll
phone.pan(phone.screen.center, direction="up", duration_ms=200)

Parameters

ParameterTypeDefaultDescription
pointtuple/PointrequiredStarting point for the pan
directionstrrequired"up", "down", "left", "right"
duration_msint500Duration of the pan gesture

Use Cases

  • Precise scrolling to specific content
  • Slow reveal of content
  • Smooth navigation

Choosing Between Flick and Pan

Best for:
  • Fast scrolling through long content
  • Page transitions
  • Natural swipe gestures
# Quick scroll through a feed
phone.flick(phone.screen.center, direction="up")

Examples

Scroll Through a List

# Scroll down through a list
for _ in range(5):
    phone.flick(phone.screen.center, direction="up")
    time.sleep(0.5)

Swipe Between Pages

# Go to next page
phone.flick(phone.screen.center, direction="left")

# Go back
phone.flick(phone.screen.center, direction="right")

Scroll to Bottom

# Keep scrolling until you reach the bottom
for _ in range(10):
    phone.flick((phone.width // 2, phone.height * 3 // 4), direction="up")
    time.sleep(0.3)

Gentle Scroll to Read

# Slow pan to read content
phone.pan(phone.screen.center, direction="up", duration_ms=1000)

Dismiss Notification

# Swipe notification away
phone.flick((phone.width // 2, 100), direction="left")

Starting Position Tips

The starting point affects the gesture’s behavior:
# Scroll from lower portion of screen (more natural)
lower_center = (phone.width // 2, phone.height * 3 // 4)
phone.flick(lower_center, direction="up")

# Scroll from upper portion
upper_center = (phone.width // 2, phone.height // 4)
phone.flick(upper_center, direction="up")
Start flicks from the lower portion of the screen for more natural scrolling behavior, mimicking how users typically scroll.

Next Steps