Adafruit has a new tutorial on creating video with an RPi and pygame. The goal is to create custom user interfaces on low cost hardware, powered by the easy to use pygame library. The tutorial walks through getting your RPi set up to run pygame, creating a basic pygame script that controls the framebuffer, and drawing an oscilloscope display on the screen.
This tutorial uses Adafruit’s WebIDE as a development environment. This is an excellent solution for working on video display, since you can develop the code on a networked computer and view the shell while running your graphical application. This is very useful for debugging, since you can just print information to your WebIDE console.
There’s a lot of potential for this setup. It would be ideal for creating any kiosk application. Maybe an announcement display, interactive kiosk, or even a programmable logic controller type user interface? What else could you build with a RPi attached to a LCD touchscreen?
Check out a video of Adafruit’s display in action after the break.
15 thoughts on “RPi Video With Pygame”
i want that screen, where can i buy it?
It’s a NTSC analog screen you can easily buy in every “car pc” shop. PAL would give a slightly better vertical resolution, but nothing close to a real monitor. Unfortunately HDMI small ones are insanely expensive and the Pi doesn’t have a VGA output.
http://www.ebay.com.au/itm/7-Inch-TFT-LCD-Color-Display-Car-Rearview-Headrest-Monitor-DVD-VCR-Reversing-/200691642429?pt=AU_Car_Parts_Accessories&hash=item2eba27703d I use one of these on my RPi, the resolution isn’t great but it is ok for playing Quake or typing on nano.
There’s a few here as well:
I’ve still yet to find any for a decent price with a decent resolution though (>800×480). They are ideal though as they can take the AV input…. whereas anything higher reso would probably use VGA (and thus an expensive adapter is needed).
The AV input is NTSC or PAL. This is AT MAX 720×512 or thereabouts. i.e. anything above 640 horizontal is more or less a waste-of-bits. (the 640720 is a bit vague: It’s an analog signal, so what’s a pixel?)
You NEED to use the HDMI output to get anything at better than effectively 640×480 resolution.
Now, the VGA converters can be bought on ebay or at chinese shops for about $15 and work great. However, I can’t find any cheap VGA screens either. For about $100 I can easily find a nice 7″ screen to add to the RPI. But why add a $100 screen to a $35 computer? For about $100 I can get a 22″ screen! That’s about 9x as large as the 7″ screen, so shouldn’t I be able to find a $15 7″ screen?
Yep, exactly what I was getting at. A cheap VGA screen would be ideal if they existed. I suppose a cheap LVDS screen would be super simple to recycle from somewhere (i.e. old laptop/netbook/handheld).
There are a few half decent low reso screens for $30-40 out there that will do the job. I do honestly feel for anything other than a terminal 640×480 should be a bare minimum (as the original poster mentioned he uses it to play quake… which I do recall playing at 640×480).
already have one of those 480×234 screens, those are awful
Yeah, it is awful (for playing quake at least) but it works for my purposes. It all just depends on what you expect out of it. My Pi will be running as a homemade portable (mostly just using command line for c++ programming and the occasional jaunt into the GUI for internet use). It runs an 12V reliably but down to 7V with clear colours (cuts out at around 6V) and only about 250mA peak current draw at 12V. Because of this it suits my purposes.
A setup like that would make for some extremely cheap thin clients/serial terminals.
what do you need the rpi for in this case?
Pygame runs on any normal pc, too….
Really? It takes a tutorial to show someone how to draw into a framebuffer these days?
pfft like you know how.
I would also suggest a look at the Lua language, the Tekui interface framework (http://tekui.neoscientists.org/screenshots.html) and the eLua project (http://www.eluaproject.net)
Kivy is a great libary for creating user interfaces with python
Bring on an open source 15″ tablet running android 4.0
Please be kind and respectful to help make the comments section excellent. (Comment Policy)