DEV Community

Tony Colston
Tony Colston

Posted on

Just getting started with pyxel

I got the idea for this post from this tweet https://twitter.com/kitao/status/1152919321032589317
It is harder to read but still super cool.

pyxel is a fun way to learn/play with Python. You can write programs that are easy to interact with and not need to think about graphics programming.

See here for the github repo: https://github.com/kitao/pyxel

To get started do a pip install

pip install pyxel
Enter fullscreen mode Exit fullscreen mode

Then type this in and run it

import pyxel
from random import random as r
pyxel.init(64,64)

def update():
    if pyxel.btnp(pyxel.KEY_Q):
        pyxel.quit()

def draw():
    pyxel.cls(0)
    pyxel.line(r()*64,r()*64,r()*64,r()*64,7)

pyxel.run(update,draw)

Enter fullscreen mode Exit fullscreen mode

You will end up with something like this:

Top comments (0)