At our last Hull Raspberry Jam, one of our budding Python coders asked me how she could detect keyboard input in a Python script and perform different actions dependent upon which key was pressed.
We both did a bit of searching around and found a few sample pieces of code, but none of them quite did what we wanted. As we were leaving I said that I would research it a bit more, and if she had not found out how to do it before the next Hull Raspberry Jam, I would have some working code for her to use.
I don’t want to ruin the surprise about what her plan is, but needless to say, it will be a very cool project if she completes what she wants to do, more on that later!
Continue reading Detecting keyboard input in Python
Our Head of Physics today asked me if there was any code we could use that would demonstrate to his A-Level Physics students the way that digital images are represented by red, green and blue pixels with a value between 0 and 255. The reason is because of the introduction of a digital imaging unit within the new A-Level specification, and whilst this could be taught as pure theory he felt a working example to illustrate the point might help.
This got me thinking and after a bit of searching I found a Stack Overflow post which gave an example of retrieving a single pixel’s RGB value and printing it out.
This example makes use of the PIL python library, which unfortunately has not been updated for Python 3. However we can make use of the Pillow library in Python 3 to achieve the same thing!
The image I have used in the code is this one:
Continue reading Extract RGB Values from an Image
So it’s a New Year and perhaps, like me for 2015 you have decided to learn some new skills or just brush up on some old ones! Well if you have then help is at hand, as Packt Publishing are running a promotion until the 6th January where you can buy any eBook from their extensive range for just £3.60 ($5) or less!
There are books to help you brush up on your Moodle skills, develop new skills in Python or even to pick up some new tips of things you can do with your Raspberry Pi!
To see the full details of the offer and all of the books available please visit this link: http://bit.ly/1uW4pQG
I’m now off to have a look through myself and decide what to get myself!