Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use the <a href="http://docs.wxwidgets.org/2.8/wx_wxhtmllistbox.html" rel="nofollow">HtmlListBox</a>, here is a little example to get you started.</p> <pre><code>import wx class PhoneNumbers(wx.HtmlListBox): def __init__(self, parent): wx.HtmlListBox.__init__(self, parent) self.data = [ ("Foo", "3452-453"), ("Bar", "5672-346"), ] self.SetItemCount(len(self.data)) def OnGetItem(self, n): return "&lt;b&gt;%s&lt;/b&gt;&lt;br&gt;%s" % self.data[n] def add_number(self, name, number): self.data.append((name, number)) self.SetItemCount(len(self.data)) self.Refresh() class Frame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, size=(200, 400)) self.numbers = PhoneNumbers(self) self.contact_name = wx.TextCtrl(self) self.contact_number = wx.TextCtrl(self) self.add_btn = wx.Button(self, label="Add contact") self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.numbers, 1, wx.EXPAND) self.Sizer.Add(wx.SearchCtrl(self), 0, wx.EXPAND) self.Sizer.Add(wx.StaticText(self, label="Name"), 0, wx.TOP, 10) self.Sizer.Add(self.contact_name) self.Sizer.Add(wx.StaticText(self, label="Number"), 0, wx.TOP, 5) self.Sizer.Add(self.contact_number) self.Sizer.Add(self.add_btn, 0, wx.ALL, 10) self.numbers.Bind(wx.EVT_LISTBOX, self.OnSelectNumber) self.add_btn.Bind(wx.EVT_BUTTON, self.OnAddNumber) def OnSelectNumber(self, event): name, number = self.numbers.data[event.Selection] self.contact_name.Value = name self.contact_number.Value = number def OnAddNumber(self, event): self.numbers.add_number( self.contact_name.Value, self.contact_number.Value ) app = wx.PySimpleApp() app.TopWindow = f = Frame() f.Show() app.MainLoop() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload