Table of Contents

video()

Function Definition: video(video_state = "on", transparency = 1)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
video_statestringSet the state of the camera feed on the stage to the specified state."on", "off", or "on flipped""on"
transparencyintSet the transparency of the video on the stage.0-1001

Description

This function helps turn the video on/off on the stage with a defined level of transparency.

  • On, the default option turns the video on, off switches it off, and on flipped turns on the camera feed, but flipped.
  • The transparency percentage can be set by entering a numeric value as an argument.

Example

The example demonstrates how to make a QR Code reader in the Python Coding Environment.

Code

sprite = Sprite('Square Box')
qr = QRCodeScanner()

qr.video("on flipped", 0)
qr.disablebox()

while True:
  qr.analysecamera()
  if qr.isdetected():
    sprite.setx(qr.xpos("center"))
    sprite.sety(qr.ypos("center"))
    sprite.setdirection(qr.angle())
    sprite.say(qr.codedata())
    sprite.show()
  else:
    sprite.hide()

Output

Read More
All articles loaded
No more articles to load