Actions

Speech Bubble

From Future Skill

Revision as of 14:14, 3 October 2022 by Filip (talk | contribs) (Created page with "=Speech Bubble quick setup= Here's an example to quickly get a speech bubble in the canvas: <div style="background: #F0F0F0> <nowiki> import SpeechBubble class Challenge:...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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,
    )