Social media generated art in Python #ThisIsMyClassroom #Programming #STEAM

Social media generated art in Python #ThisIsMyClassroom #Programming #STEAM

For the third blog post on this topic I wanted to use Python to generate different pieces of art without relying entirely on the random function. I decided to use the tweepy library, mainly because I had already used it to post content to Twitter but had never investigated how it could be used to read information back from Twitter.

It didn’t take long to find out how to read the latest 10 tweets from my own timeline using Python. Then I split the individual words into a list and sorted them into alphabetical order (for no real reason at the moment, but frequency analysis will follow!). Then I used the write method from the Turtle graphics library to place each word at a random location on the screen. This was my first attempt:

Screen Shot 2016-04-03 at 23.50.08

A bit tricky to read the words I thought. And I’d accidentally forgotten to penup before moving the turtle. However this accidental vector spider web became part of the artwork (because when I removed it, it looked quite boring).

A little while later I was able to change the font size at random (I changed the font to palatino after experimenting with a few others) and changing the pencolor in the same way as previous Python art programs changed the text colour too.

Screen Shot 2016-04-03 at 23.53.35

I had a lot of text to display, even just from 10 tweets, so I thought of ways to reduce the amount. I wrote a little Python subroutine that removed hashtags, mentions and URLs (as well as any other non ASCII text) and that was enough!

The video below shows the program in action. I decided to make a video this time because you can make out the individual words much more clearly at the beginning of the drawing than at the end!

As before the code is now on github (with my tweepy details removed for security). I’ve left in a commented out section of code that allows you to run a search for a keyword, hashtag or phrase instead of taking the latest timeline so you can experiment.

Any comments or improvements would be much appreciated!

Using CodeBug tethered via USB on a MacBook

It has been a few weeks since our CodeBugs arrived here in Milan and after playing around with some of the sample programs and thinking about their features I have decided to use these with next session’s Year 10 students as an introduction to the iGCSE Computer Science course in September.

While they worked really well with the Raspberry Pi I struggled to get the CodeBugs working with IDLE on the MacBook. Installing packages via Terminal updated the Python 2.7 install that comes with the OS and – for me anyway – Homebrew complicated what should have been a very easy process. In Visual Studio if you wanted to use a module library you simply added it to the project and IDLE does not have this function.

I found PyCharm today – an IDE for Python that allows me to add the codebug_tether module (and any others I need) with the minimum of fuss. Now my CodeBug can be programmed while connected via USB to my MacBook! As an added bonus I learned more about Virtual Environments.

IMAG1237

To make it easier for my students to get going with their CodeBugs in September I created a 20-step guide linked here. It’s CC0 so please feel free to use and adapt as required. If you find any mistakes or it just doesn’t work for you in the same way please let me know.

Using @EdPuzzle for the first time #flipclass #flipchat

EdPuzzle is not a new site to me, however I’ve never had the time to sit down and investigate it properly. I got the opportunity today as the rain made an overdue visit to Milan.

My Year 10 Computer Science students are revisiting the Python language and I gauged their knowledge during class last week. As they all selected similar problems to solve I decided to share my solutions via video and take advantage of the embedded questioning offered by EdPuzzle.

I had intended to link to the finished EdPuzzle from a Google Form and then mark student submissions using Flubaroo however I was happy to see that EdPuzzle linked to Google Classroom and recorded student results and progress for me.

I’ve attached a quick video walkthrough of one of the tasks below, in case you want to see how it works. I think that next time I’ll make one video so that students do not have two tasks to complete but would appreciate any other feedback or suggestions!

Programming on an iPad #compSci #RGCdevicetrial

At the start of the #RGCdevicetrial I was very cynical about the effectiveness of iPads in education. I did not think they were suitable for use in secondary school classrooms. I saw them as content consumption devices, tailored for personal use only, and an expensive gimmick destined to gather dust in a department store cupboard (much like the iPod touch devices bought en-masse a few years ago).

I’m happy to state that I was wrong. For me, the iPad is a very strong contender for not only becoming the device of choice at our school but for eventually replacing desktop PCs in the Computing classroom too.

Like many others I thought it wasn’t possible to program on the iPad. I’d heard about Scratch being removed from the App Store and, whilst working on a successful Internet Safety project at Inverurie Academy in 2011, had fought a battle of wits with XCode to create and install a series of simple apps on the aforementioned iPod touch devices. I didn’t want to rely on having a spare Macbook sitting around for pupils to code on, in a language that was fairly impenetrable, just to be able to use the iPad in a Computing Science classroom.

However, after speaking to Fraser Speirs at a SCIS event in Edinburgh a few weeks ago, I realised that it was possible. He told me about Pythonista, which allows you to create command-line or graphical programs straight on the iPad. Fraser also told me that he pays for processing time on Amazon servers and gets students to upload code from their iPads and execute it remotely. The extra benefit of this, he says, is that his pupils have access to the same programming environment regardless of their location. It allows them to continue coding at home on a task they may have started in school.

For early stage programmers one app that helps build coding foundations through sequential instructions is A.L.E.X. I downloaded it whilst setting up the iPad for the #RGCdevicetrial and accidentally syncronised it with the iPad Mini which was being used by the ICT specialist in our primary school. She loved the app so I gave it a go last week while learning more about how an iPad mirrors to a data projector using Apple TV. There were young pupils in the playground outside with their noses against the window as they watched the robot move through the levels.

This morning I spotted a retweet by Dawn Halybone and had to investigate further:

20130313-231307.jpg

Snap! is a web-based drag and drop programming language developed at Berkeley. Very similar to Scratch, you create programs by associating scripts with sprites on a stage. It runs through a browser so you have to be online to use it however it looks very stable on the iPad. Even though the most recent Scratch beta is also web-based, it does not work with the iPad due to the fact it needs Adobe Flash to play content. I wasn’t even able to access the code screen on the site so, for the moment anyway, Snap seems to be the only option.

Do you know of any other apps or websites that allow programming on the iPad? Please share!