/src/examples/Level2/Display/wx_demo.py

http://pythonocc.googlecode.com/ · Python · 49 lines · 16 code · 9 blank · 24 comment · 0 complexity · 4fac737367f07d38258de17d8551214b MD5 · raw file

  1. #!/usr/bin/env python
  2. ##Copyright 2009-2011 Thomas Paviot (tpaviot@gmail.com)
  3. ##
  4. ##This file is part of pythonOCC.
  5. ##
  6. ##pythonOCC is free software: you can redistribute it and/or modify
  7. ##it under the terms of the GNU Lesser General Public License as published by
  8. ##the Free Software Foundation, either version 3 of the License, or
  9. ##(at your option) any later version.
  10. ##
  11. ##pythonOCC is distributed in the hope that it will be useful,
  12. ##but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ##GNU Lesser General Public License for more details.
  15. ##
  16. ##You should have received a copy of the GNU Lesser General Public License
  17. ##along with pythonOCC. If not, see <http://www.gnu.org/licenses/>.
  18. from OCC.BRepPrimAPI import *
  19. from OCC.Display.SimpleGui import *
  20. set_backend('wx')
  21. display, start_display, add_menu, add_function_to_menu = init_display()
  22. #from OCC.Graphic3d import *
  23. from OCC.BRepPrimAPI import *
  24. #from OCC.Utils.Image import Texture
  25. #import os, os.path
  26. def simple_test(event=None):
  27. display.Test()
  28. def simple_cylinder(event=None):
  29. s = BRepPrimAPI_MakeCylinder(60, 200)
  30. display.DisplayShape(s.Shape())
  31. # set up menus
  32. add_menu('wx tests')
  33. add_function_to_menu('wx tests',simple_test)
  34. add_function_to_menu('wx tests',simple_cylinder)
  35. #
  36. # Display settings
  37. #
  38. display.View_Iso()
  39. display.FitAll()
  40. start_display()