Re: Virtual Keyboard for PiTFT
by wbp on Sun Mar 02, 2014 12:50 pm
Andrew,
The background surface is created with this line in class VirtualKeyboard:
self.background = pygame.Surface((320,240))
To load an image instead, use this:
self.background = pygame.image.load("someimage.png")
You can also set the background to be transparent, as it was in the original version, see this line:
self.keylayer.set_alpha(100)
Which brings up a point - the original version had a background and a transparent overlayer for the keys. I found that very distracting on this small screen, so I left alpha at default, which is opaque. If you look at the code you'll see there are actually two surfaces, both the same size, one on top of the other, the "background" and the "keylayer". Since both are the same size, we don't really need both now. I'll fix that...
I've got a 2 line input text box now, and I"m working on splitting the text. I'll post the update when I've got it working.
William