equal
deleted
inserted
replaced
35 LISTBOX_INTERVAL_HEIGHT = 6 |
35 LISTBOX_INTERVAL_HEIGHT = 6 |
36 |
36 |
37 |
37 |
38 class PopupWithListbox(wx.PopupWindow): |
38 class PopupWithListbox(wx.PopupWindow): |
39 |
39 |
40 def __init__(self, parent, choices=[]): |
40 def __init__(self, parent, choices=None): |
41 wx.PopupWindow.__init__(self, parent, wx.BORDER_SIMPLE) |
41 wx.PopupWindow.__init__(self, parent, wx.BORDER_SIMPLE) |
42 |
42 |
43 self.ListBox = wx.ListBox(self, -1, style=wx.LB_HSCROLL | wx.LB_SINGLE | wx.LB_SORT) |
43 self.ListBox = wx.ListBox(self, -1, style=wx.LB_HSCROLL | wx.LB_SINGLE | wx.LB_SORT) |
44 |
44 |
|
45 choices = [] if choices is None else choices |
45 self.SetChoices(choices) |
46 self.SetChoices(choices) |
46 |
47 |
47 self.ListBox.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) |
48 self.ListBox.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) |
48 self.ListBox.Bind(wx.EVT_MOTION, self.OnMotion) |
49 self.ListBox.Bind(wx.EVT_MOTION, self.OnMotion) |
49 |
50 |