home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/python
- #
- # Copyright (c) 1996 by Lele Gaifax. All Rights Reserved
- #
- # This file is part of the PyObjC package.
- #
- # $RCSfile: LittleButtonedWindow.py,v $
- # $Revision: 1.1.1.3 $
- # $Date: 1996/11/14 01:49:45 $
- #
- # Created Fri Sep 13 12:26:15 1996.
- #
-
- import ObjC
-
- rt = ObjC.runtime
- Application = rt.Application
- Window = rt.Window
- Button = rt.Button
-
- # Note the new syntax: this is equivalent of Application.new()
- NXApp = Application()
- win = Window.alloc()
- frame = ((200.0, 300.0), (250.0, 100.0))
- win.initContent__style__backing__buttonMask__defer__(frame, 6, 2, 5, 0)
- win.setTitle__ ('LittleButtonedWindow')
- but = Button.alloc().initFrame__ (((10.0, 10.0), (10.0, 10.0)))
-
- framep = but.getFrame__.pack_argument (0)
- but.getFrame__ (framep)
- print "The script created a button framed", but.getFrame__.unpack_argument (0, framep)
- print "which should give the same result as", framep.unpack()
-
- win.contentView().addSubview__(but)
- but.setTarget__(NXApp)
- but.setAction__('stop:')
- win.display()
- win.makeKeyAndOrderFront__(NXApp)
- NXApp.run()
-