Skip to content

Get courser position from widget to enable interactive videos. #2407

@kolibril13

Description

@kolibril13

I want to make interactive videos.
This is possible with checkboxes like this:

from ipywidgets import Video, Image
from IPython.display import display
from ipywidgets import Checkbox
fileA= 'videoA.mp4'
fileB= 'videoB.mp4'
video = Video.from_file(fileB)
top_toggle = Checkbox(description='Change Video')

def video_loader(filename):
    with open(filename, 'rb') as f:
        video.value = f.read()
def video_change(button):
    if button['new']:
        video_loader(fileA)
    else:
        video_loader(fileB)
top_toggle.observe(video_change, names='value')

display(top_toggle)
display(video)

But I would like to change the video with the mouse cursor position. Is there a function to observe x and y positions of the courser in a "click" event?
out

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions