Advertisement
Guest User

Untitled

a guest
May 25th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #------------------------------------------------------------------------------
  2. # Copyright (c) 2013, Nucleic Development Team.
  3. #
  4. # Distributed under the terms of the Modified BSD License.
  5. #
  6. # The full license is in the file COPYING.txt, distributed with this software.
  7. #------------------------------------------------------------------------------
  8. """ An example of using the `Menu` widget as a context menu.
  9.  
  10. << autodoc-me >>
  11. """
  12. from enaml.widgets.api import *
  13. from enaml.stdlib.fields import FloatField
  14.  
  15.  
  16. enamldef SampleAction(Action):
  17. text = '%s action %d' % (parent.title, parent.children.index(self))
  18. triggered :: print text
  19.  
  20.  
  21. enamldef SampleMenu(Menu):
  22. SampleAction: pass
  23. SampleAction: pass
  24. SampleAction: pass
  25. Container:
  26. Form:
  27. Label:
  28. text = 'Energy'
  29. FloatField:
  30. value = 10.
  31.  
  32.  
  33. enamldef Main(Window):
  34. Container:
  35. Field:
  36. text = 'foo'
  37. Field:
  38. text = 'bar'
  39. SampleMenu:
  40. title = 'bar'
  41. context_menu = True
  42. Field:
  43. text = 'baz'
  44. SampleMenu:
  45. title = 'baz'
  46. context_menu = True
  47. PushButton:
  48. text = 'its a button!'
  49. SampleMenu:
  50. title = 'button menu'
  51. context_menu = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement