PageRenderTime 46ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/python/enum/runme.py

#
Python | 31 lines | 19 code | 9 blank | 3 comment | 0 complexity | f2b0bf8220ef313c0effe73a97493d68 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. # file: example.py
  2. import example
  3. # ----- Object creation -----
  4. # Print out the value of some enums
  5. print "*** color ***"
  6. print " RED =", example.RED
  7. print " BLUE =", example.BLUE
  8. print " GREEN =", example.GREEN
  9. print "\n*** Foo::speed ***"
  10. print " Foo_IMPULSE =", example.Foo.IMPULSE
  11. print " Foo_WARP =", example.Foo.WARP
  12. print " Foo_LUDICROUS =", example.Foo.LUDICROUS
  13. print "\nTesting use of enums with functions\n"
  14. example.enum_test(example.RED, example.Foo.IMPULSE)
  15. example.enum_test(example.BLUE, example.Foo.WARP)
  16. example.enum_test(example.GREEN, example.Foo.LUDICROUS)
  17. example.enum_test(1234,5678)
  18. print "\nTesting use of enum with class method"
  19. f = example.Foo()
  20. f.enum_test(example.Foo.IMPULSE)
  21. f.enum_test(example.Foo.WARP)
  22. f.enum_test(example.Foo.LUDICROUS)