Actions

Speech Bubble

From Future Skill

Speech Bubble quick setup

Here's an example to quickly get a speech bubble in the canvas:

import SpeechBubble


class Challenge:
  def __init__(self, context):
    ...
    canvas = self._context.canvas
    canvas_width = 20 # Shall match width setting 
    cavnas_height = 10 # Shall match height setting 
    x_c = canvas_width / 2
    y_c = canvas_height * 3 / 4
    text_in_bubble = "This is an example text\n which will be displayed in bubble"
    the_bubble = SpeechBubble(
        canvas,
        canvas_width,
        canvas_height,
        x_c,
        y_c,
        arrow_dest = "SE",
    )
    create_bubble_adaptive_size(
      text_in_bubble, 
    )
    bubble_widht = 5
    bubble_heigh = 2
    create_bubble_fix_size(
      text_in_bubble, 
      bubble_widht, 
      bubble_height,
    )

The graphics require several pictures to be added to the exercise manually. Below is provided a zip file (contact FS if you cannot get access) or use the individual links for all the pictures: Here are the links to the pictures needed, they need to be renamed!:

https://s3-eu-central-1.amazonaws.com/sws-uploads/62a844bdbb4941591ca58a8d/631861f5b85cd5df6f0aa31f.png

https://s3-eu-central-1.amazonaws.com/sws-uploads/62a844bdbb4941591ca58a8d/631861fcb85cd5df6f0aa327.png