Can I use Pyscript and the Zelle graphics library?

Two questions :

I would like to use the Pyscript and a python program I have writtin. The program I have written uses the Zelle graphics library. It is imported, but the Zelle graphics library is only a py file.

Zelle: Zelle Graphics Reference

  1. Will Pyscript work in this situtation?
  2. Will Pyscript work with wav files and gifs?

Thank you!


Assuming it’s the same as (or similar to) the Zelle Graphics Library that Google lead me to, sadly it won’t work in Pyscript out of the box.

Looking at (around line 165), we can see it uses tkinter as its underlying GUI framework, which is not currently supported by the Pyodide runtime that underpins Pyscript.

For your second question, there are a handful of Python libraries that can work with audio and image files, like wave from the standard library and PIL/Pillow, respectively.

But fair warning - audio playback within the browser is likely to be quite different from audio playback in a desktop environment, so playing sound directly is unlikely to work. Additionally, it looks like several of the popular audio processing libraries rely on the ffmpeg utility, and while there is an experimental WASM port, I’d be surprised it it married cleanly with Pyscript on the first go.

I’d love to be wrong though. :+1:

Thank you for the reply. Is Tkinter something that will be supported in future versions?

It is unlikely that you will see Tkinter in the browser any time soon. It would be great if traditional desktop GUI toolkits could be simply ported, but they are designed to interface with desktop OS displays. More likely, will be python bindings to JS GUI toolkits, or the arrival of python interfaces that abstract over different toolkits (see beeware’s toga project).

1 Like