pylcduiLibrary for CrystalFontz and Matrix-Orbital LCD displays | |
Download |
pylcdui Ranking & Summary
Advertisement
- License:
- GPL
- Price:
- FREE
- Publisher Name:
- Mike Wakerly
- Publisher web site:
- http://code.google.com/u/@WBlQQFBUDhJHWQN4/
pylcdui Tags
pylcdui Description
Library for CrystalFontz and Matrix-Orbital LCD displays pylcdui is a collection of driver libraries for character LCD displays. It provides a Python interface to common features of character LCD displays: turn on the backlight, clear the screen, write a line of data.What else is it?pylcdui is also a tiny user interface framework for building simple applications atop a character LCD. The ui (user interface) part includes standard widgets for things like progress bars, multiple choice menus, and so on.Note: pylcdui has recently been rewritten, since the author thought all of his old code was crap. Alpha quality code ahead.How about an example?Each distribution of pylcdui comes with a free virtual character display!from lcdui.devices import Genericdevice = Generic.MockCharacterDisplay(rows=4, cols=40)Of course, that's not very interesting. You could also use one of the included serial LCD drivers, such as for the CrystalFontz 635 display:device = CrystalFontz.CFA635Display(port='/dev/ttyUSB0')device.ClearScreen()device.WriteData("Hello, world!", row=0, col=1)For higher level operations, you can create a ui instance and attach your LCD to it:from lcdui.ui import uiui = ui.LcdUi(device)A ui instance displays a single "frame" at any given time. A frame is essentially a container of "widgets".f = ui.FrameFactory(frame.Frame)ui.SetFrame(f)You should probably add some widgets to your frame. Widgets come in several types, the simples of widgets is simply a line of text.line1 = widget.LineWidget(contents="Hello, world!")f.AddWidget("line1", line1, row=0, col=0)Great! Now you have your line widget in place at row 0 column 0. The last step is to ask the frame to repaint, which in turn causes each widget to build and return the character implementation suitable for drawing.ui.Repaint() Requirements: · Python
pylcdui Related Software