~justin-fathomdb/nova/justinsb-openstack-api-volumes

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/doc/core/examples/pyuidemo.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
 
4
# See LICENSE for details.
 
5
 
 
6
 
 
7
import pyui
 
8
from twisted.internet import reactor, pyuisupport
 
9
 
 
10
def onButton(self):
 
11
    print "got a button"
 
12
 
 
13
def onQuit(self):
 
14
    reactor.stop()
 
15
 
 
16
def main():
 
17
    pyuisupport.install(args=(640, 480), kw={'renderer': '2d'})
 
18
 
 
19
    w = pyui.widgets.Frame(50, 50, 400, 400, "clipme")
 
20
    b = pyui.widgets.Button("A button is here", onButton)
 
21
    q = pyui.widgets.Button("Quit!", onQuit)
 
22
    
 
23
    w.addChild(b)
 
24
    w.addChild(q)
 
25
    w.pack()
 
26
 
 
27
    w.setBackImage("pyui_bg.png")
 
28
    reactor.run()
 
29
 
 
30
if __name__ == '__main__':
 
31
    main()