Skip to content

Transparency + keyboard/mouse events

Compare
Choose a tag to compare
@ShashkovS ShashkovS released this 17 Mar 23:33
· 31 commits to master since this release

New features:

  • Transparency is also straightforward via alpha or RGBA:
filled_circle('blue', (100, 110), 22, alpha=100)
polygon((0, 0, 255, 200), [(20, 300), (100, 340), (40, 260)], line_width=15)
  • Keyboard and mouse events
    Process keyboard events in two ways: check if key is pressed via get_keys_pressed() or run throw keysdown or keysup events
        # Mouse buttons events
        if mousebuttonsdown:
            x, y = mousebuttonsdown[0].pos
        # Keys which are still pressed
        keys = get_keys_pressed()
        if keys[K.UP] or keys[K.w]:
            y -= 5
        # Keyboard events
        for ev in keysdown:
            if ev.unicode:
                upper_text += ev.unicode