home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Languages / python / PyObjC-0.47-MIHS / pyobjc-0.47-src / Demo / ObjC / LittleButtonedWindow / LittleButtonedWindow.py next >
Encoding:
Python Source  |  1996-11-13  |  1.0 KB  |  40 lines

  1. #!/usr/local/bin/python
  2. #
  3. # Copyright (c) 1996 by Lele Gaifax.  All Rights Reserved
  4. #
  5. # This file is part of the PyObjC package.
  6. #
  7. # $RCSfile: LittleButtonedWindow.py,v $
  8. # $Revision: 1.1.1.3 $
  9. # $Date: 1996/11/14 01:49:45 $
  10. #
  11. # Created Fri Sep 13 12:26:15 1996.
  12. #
  13.  
  14. import ObjC
  15.  
  16. rt = ObjC.runtime
  17. Application = rt.Application
  18. Window = rt.Window
  19. Button = rt.Button
  20.  
  21. # Note the new syntax: this is equivalent of Application.new()
  22. NXApp = Application()
  23. win = Window.alloc()
  24. frame = ((200.0, 300.0), (250.0, 100.0))
  25. win.initContent__style__backing__buttonMask__defer__(frame, 6, 2, 5, 0)
  26. win.setTitle__ ('LittleButtonedWindow')
  27. but = Button.alloc().initFrame__ (((10.0, 10.0), (10.0, 10.0)))
  28.  
  29. framep = but.getFrame__.pack_argument (0)
  30. but.getFrame__ (framep)
  31. print "The script created a button framed", but.getFrame__.unpack_argument (0, framep)
  32. print "which should give the same result as", framep.unpack()
  33.  
  34. win.contentView().addSubview__(but)
  35. but.setTarget__(NXApp)
  36. but.setAction__('stop:')
  37. win.display()
  38. win.makeKeyAndOrderFront__(NXApp)
  39. NXApp.run()
  40.