|
Powered by: |
"Everything should be as simple as possible, but no simpler", Albert Einstein
Overview:
PyUI is a user interface library written entirely in the high-level language python. It has a modular implementation that allows the drawing and event input to be performed by pluggable "renderers". This makes PyUI very portable and scalable. It can run in environments from hardware accelerated 3D surfaces to regular desktop windows. PyUI was originally targeted as a User Interface for games, but it has evolved into a more general UI toolkit with applicability outside of games.
The goal of pyui is that is be very simple to use and that the implementation be kept as simple as possible. Some lessons learned from Extreme Programming are being applied to the development process. The current state of PyUI is no longer exactly simple as it evolves towards being a fully features GUI toolkit, but the development methodology has been successful in keeping the code stable and usable throughout its life so far.
PyUI is being used on a commercial computer game development project at Ninjaneering and is owned by Sean Riley, one of the founders of that company. If you are using or thinking of using PyUI, drop us an email!
Features:
News:
PyUI 0.95 is out. This is a step towards a 1.0 release one day.
There have been performance improvements to the GL renderers with the
use of cached display lists for window drawing, and experimental
true-type font renderering with OpenGL on win32. Also, the PyGame
OpenGL renderer now uses PyGame for image loading, reducing the
dependency on P.I.L. to only be used for the GLUT renderer.
The PyUI source code has been moved from the Perforce repository at Ninjaneering to CVS on Source Forge. This should make it easier for people to access the latest version and for developers to interact with each other. The latest code also supports TrueType fonts under OpenGL - but only on Windows for now.
The 0.93 relase is out! Includes a spreadsheet-like Sheet class, a NumberEdit class and bug fixes. Also, this introduces the Boat classes for interacting with a database using Twisted. This relase also see the retirement for now of the Win32 renderer. The overhead that was being introduced to every renderer to deal with the Win32 renderer's per-widget drawing has become unacceptable! It is gone for now.
The 0.92 release was released which included a file dialog, a color picker and bug-fixes.
The 0.91 release includes an improved win32 renderer that interacts with the windows desktop in a much friendlier way, plus a number of bug fixes. It also includes a theme that resembles native Windows2000 look which is a good example for other people who wish to make themes.
The 0.9 release is out! Many new features including new widgets and optimizations. Some people are using PyUI! I am planning on including a set of links to other projects and some screenshots here.
The 0.8 release includes many improvements including keyboard navigation, cleaner drawing, a re-designed default theme, text wrapping, GUI callback events and the re-introduction of transparency . The stability and maturity of PyUI have advanced greatly since the 0.7x releases thanks mainly to the code contributions from Peter Freese.
The 0.7 release includes two new renderers, a Win32 GDI renderer for light weight Windows applications, and a TK renderer that uses the TK Canvas widget!
As of the 0.6 release, it is possible to implement new renderers for PyUI! There are stubs in the 0.6 release for a DirectX based renderer.
As of the 0.5 release, PyUI is now running under hardware accelerated OpenGL. This is a big performance boost and give access to loads of new functionality in the 3D world! This change does however mean there are more dependencies to get PyUI running.
Dependencies:
The dependencies for Pyui depend themselves on which renderer is being used. The core of Pyui - the widgets, desktop and infrastructure, have no external dependencies. The dependencies for the renderers are:
PyGame 2D Renderer
PyGame OpenGL Renderer
GLUT OpenGL Renderer
Python 2.1 | http://www.python.org |
PyGame 1.1 | http://www.pygame.org |
PyOpenGL | http://pyopengl.sourceforge.net |
Python Imaging Library | http://www.pythonware.com/products/pil |
Screenshots:
Layouts | Examples of the various layout managers |
Dialog | A transparent modal dialog |
Console | The python console in action |
Minesweeper | An implementation of the "Mine Sweeper" game in PyUI |
SpreadSheet! | The Sheet class |
Background | drawing on the desktop background |
OpenGL 3D | Intergration with a 3D scene |
Green | The "green" theme with a window and submenus open |
Download:
The current version of pyui is 0.95 which can be downloaded here or from the Source Forge Pyui page. Make sure you have at least python and pygame installed!
PyUI Development
The PyUI development source code currently lives in a CVS repository on Source Forge. The projects is called PyUIcvs. Anonymous CVS access is available:
cvs -d:pserver:anonymous@cvs.pyui.sourceforge.net:/cvsroot/pyui login cvs -z3 -d:pserver:anonymous@cvs.pyui.sourceforge.net:/cvsroot/pyui co PyUIcvs
You can Browse the CVS repository.
Documentation:
I have started on some PyUI Documentation. There is still much to do. Contributions would be welcome :)
PyUI Architecture:
(NOTE: this diagram needs to be updated for the 0.7 - 0.9 changes)
Example Code:
import testopt import time import pyui def onbutton(self): print "got a button " def run(): opts = testopt.parseCommandLine(800, 600) done = 1 frame = 0 t = time.time() pyui.init(*opts) w = pyui.widgets.Frame(50, 50, 400, 400, "clipme") b = pyui.widgets.Button( "A button is here", onbutton) w.addChild(b) w.pack() w.setBackImage("max.bmp") pyui.run() print "done" pyui.quit() if __name__ == '__main__': run()