Mondrian-bot

This will probably be my last post about making Mondrian's for a while (at least until I make art, or dress up as a Mondrian for Halloween). After my success in making a function to make random Mondrian-like drawings in canvas with JavaScript, I wanted the ability to save the drawings, and share them in an easy fashion. This seemed like a perfect job for Twitter.

I spent a very brief amount of time trying to figure out how to save canvases from JavaScript, and that eventually seems like a logical thing to learn. I have been coding mostly in JavaScript recently due to the ease in which I can access it from different locations, but I decided to return to Python today to accomplish this task. Having something on my local machine means that handling the files would be a little easier. Of course, that meant re-writing all of my code to get it to work in Python.

I am not necessarily an expert at any language, and I do not switch between them enough to remember all of the slight syntax differences; however, it was easy enough to figure it out via Google searches and testing simple bits in Python. I ended up using PIL to draw my lines and rectangles. The nice part of this code is that I was able to use the simplest of commands in the program and did not need to go up too steep of a learning curve. I used a nice tutorial for help in building the Twitter-bot for posting images. I did not have too much problem building this, except for converting the code.

All of my code can be found here, and you can even follow the Twitter bot on @OvalNeutron (at least until I decide that I change the use of that handle).