Created
April 17, 2025 15:48
-
-
Save mariobuikhuizen/c9444ac434ad5dd7c58ba0845e092847 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ipyvuetify as v | |
import traitlets | |
class SoundWidget(v.VuetifyTemplate): | |
def send_sound_buffer(self, coordinate, data): | |
self.send({ | |
'method': 'sound_buffer', | |
'args': [coordinate], | |
}, buffers=[data]) | |
@traitlets.default("template") | |
def _template(self): | |
return """ | |
<template> | |
</template> | |
<script> | |
module.exports = { | |
data() { | |
spaxels: {}; | |
}, | |
methods: { | |
jupyter_sound_buffer(coordinate, buffers) { | |
console.log({coordinate, data: buffers[0]}); | |
this.spaxels[coordinate] = buffers[0]; | |
} | |
} | |
} | |
</script> | |
""" | |
sound_widget = SoundWidget() | |
sound_widget.send_sound_buffer("0,0", bytes([1, 2, 3, 4])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment