Run Pyxel on your blog! (ブログ上でPyxelを動かそう!)

Dear Pyxel users, are you enjoying the web version of Pyxel? In Pyxel 1.8.17, I added a function that allows you to run Pyxel directly on your blog.

Pyxelユーザーの皆様。Web版Pyxelを楽しんでいただけていますか? Pyxel 1.8.17でPyxelをブログの上で直接動かせる機能を追加したのでご紹介します。

How to use Pyxel Web (Web版Pyxelの使い方)

For basic usage of the web version of Pyxel, please refer to the previous article.


How to run Pyxel on your blog (ブログ上でのPyxelの動かし方)

You can run Pyxel on your blog by creating a div tag with the id pyxel-screen and executing the function launchPyxel from JavaScript.


The arguments of the launchPyxel function are the same as for custom Pyxel elements. For example, if you want to write Python code directly, add the following tag to your blog


<div id="pyxel-screen" style="position: relative; width:300px; height:300px"></div>
<script src=""></script>
let script=`
import pyxel
pyxel.init(100, 100)
pyxel.line(0, 0, 100, 100, 7)
launchPyxel({ command: "run", script: script });

It then looks like this.