Python and XUL: Luxor XUL Python Example Suite Released
Gerald Bauer
gerald@vamphq.com
2 Mar 2003 08:07:39 -0800
The Luxor XUL (XML User Interface Language) Python example suite is
now available and includes a mini calculator, a channel surfer, a
counter and more.
Grab a copy at http://sourceforge.net/project/showfiles.php?group_id=28946
(look for the luxor-python-examples package).
Here's a sneak preview:
counter.xul:
================================
<xul>
<vbox id="COUNTER">
<groupbox>
<caption label="Counter"/>
<textbox id="DISPLAY"
style="align: center; color: yellow; background: black; font:
24 bold monospace;" />
</groupbox>
<hbox>
<button label="Dec (-)" command="dec" style="width: 90px" />
<button label="Clear" command="clear" style="width: 90px" />
<button label="Inc (+)" command="inc" style="width: 90px" />
</hbox>
</vbox>
</xul>
counter.py
================================
# -- cut --
class CounterForm( XulForm ):
def __init__( self ):
XulForm.__init__( self, "COUNTER" )
self.setup()
def init( self ):
self.display = XulInput( self, "DISPLAY" )
def setCounter( self, counter ):
self.display.text = str( counter )
class AppFrame( JFrame ):
def __init__( self ):
JFrame.__init__( self, "Luxor Counter Example" )
DynXulAction( "inc", self.onIncCounter )
DynXulAction( "dec", self.onDecCounter )
xul = XulMan( "c:/sandbox/python/src/counter/chrome" )
def onIncCounter( self ):
self.counter += 1
self.updateCounter()
def onDecCounter( self ):
self.counter -= 1
self.updateCounter()
# -- cut --
That's it. Enjoy.
- Gerald (Luxor Project Lead)
PS: What is XUL?
To get started with XUL (XML User Interface Language) check out the
Richmond Post XUL Link-opida online @
http://luxor-xul.sourceforge.net/post/links.html
PSS: What is Luxor?
Luxor is an open-source XML User Interface Language (XUL) toolkit in
Java that supports handpicked Mozilla XUL goodies and includes a web
server, a portal engine (supporting RSS), a template engine
(Velocity), a scripting interpreter (Python) and more. For more info
check out the Luxor site @ http://luxor-xul.sourceforge.net