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