Last active
August 29, 2015 14:11
-
-
Save jrosco/ee6c606f3338adb2db31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#http://www.wxpython.org/docs/api/wx.lib.combotreebox-module.html#ComboTreeBox | |
from wx.lib.combotreebox import ComboTreeBox | |
import wx | |
class MyFrame(wx.Frame): | |
def __init__(self, parent): | |
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Combo Tree Test", pos=wx.Point(-1, -1), | |
size=wx.Size(400, 40), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) | |
combo = ComboTreeBox(self) | |
item1 = combo.Append('A') # Add a root item | |
item2 = combo.Append('B') # Add a root item | |
item1a = combo.Append('.ace', parent=item1) # Add a child to item1 | |
item1b = combo.Append('.age', parent=item1) # Add a child to item1 | |
item2a = combo.Append('.big', parent=item2) # Add a child to item1 | |
if __name__ == "__main__": | |
app = wx.App(False) | |
frame = MyFrame(None) | |
frame.Show(True) | |
app.MainLoop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#http://www.wxpython.org/docs/api/wx.lib.combotreebox-module.html#ComboTreeBox | |
from wx.lib.combotreebox import ComboTreeBox | |
import wx | |
import string | |
class MyFrame(wx.Frame): | |
def __init__(self, parent): | |
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Combo Tree Test", pos=wx.Point(-1, -1), | |
size=wx.Size(400, 40), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) | |
combo = ComboTreeBox(self) | |
ascii_list = list(string.ascii_uppercase) | |
tld_list = ['charge', 'ace', 'bob', 'cat', 'zed', 'dog', 'boo', 'attach'] | |
tld_list.sort() | |
for xl in ascii_list: | |
item = combo.Append(xl) # Add a root item | |
for xl2 in tld_list: | |
upperlist = xl2.upper().split()[0][0] | |
if upperlist == xl: | |
combo.Append(xl2, parent=item) | |
if __name__ == "__main__": | |
app = wx.App(False) | |
frame = MyFrame(None) | |
frame.Show(True) | |
app.MainLoop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment