1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 """Module for the main relax menu bar."""
26
27
28 import wx
29
30
32 """Construct and return the menu sub-item.
33
34 @param menu: The menu object to place this entry in.
35 @type menu: wx.Menu instance
36 @keyword id: The element identification number.
37 @type id: int
38 @keyword text: The text for the menu entry.
39 @type text: None or str
40 @keyword tooltip: A tool tip.
41 @type tooltip: str
42 @keyword icon: The bitmap icon path.
43 @type icon: None or str
44 @keyword fn: The function to bind to the menu entry.
45 @type fn: class method
46 @return: The initialised wx.MenuItem() instance.
47 @rtype: wx.MenuItem() instance
48 """
49
50
51 if id == None:
52 id = wx.NewId()
53
54
55 element = wx.MenuItem(menu, id, text, tooltip)
56
57
58 if icon:
59 element.SetBitmap(wx.Bitmap(icon))
60
61
62 if fn and parent:
63 parent.Bind(wx.EVT_MENU, fn, id=id)
64
65
66 return element
67