Table of Contents

readpushbutton()

Function Definition: readpushbutton(button = "L")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
buttonstringThe specific button for which the state is required."L" or "R""L"

Description

The function returns the state of the specified push button. If the button is pressed it returns True or else False.

Example

The example demonstrates how to make the sprite movement with Quarky buttons.

Code

sprite = Sprite('Tobi')
quarky=Quarky()

while True:
  if quarky.readpushbutton("L"):
    sprite.move(-10)
  elif quarky.readpushbutton("R"):
    sprite.move(10)

Output

Read More
All articles loaded
No more articles to load