1st things 1st: Hi and good to be back after almost 3 years ...
I am stuggling w/ a stupid positioning problem of an entry box
(TextCtrl) to be displayed inside a hyperTreeCtrl.
WHAT I WANT:
A tree when opened displays a text Ctrl IN FRONT of an item so users
can enter the amount of the item they want to order.
WHAT I HAVE:
A tree when opened displays the TextCtrl AFTER the actual item
WHAT I DID (the last four lines i am struggling w/) :
def CreateProductsHyperTreeCtrl(self):
tree = HTL.HyperTreeList(self, -1, wx.Point(0, 0), wx.Size(400, 250),
wx.TR_DEFAULT_STYLE | wx.NO_BORDER,
wx.TR_HAS_BUTTONS | wx.TR_HAS_VARIABLE_ROW_HEIGHT)
imglist = wx.ImageList(16, 16, True, 2)
imglist.Add(wx.ArtProvider.GetBitmap(wx.ART_FOLDER,
wx.ART_OTHER, wx.Size(16, 16)))
imglist.Add(wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,
wx.ART_OTHER, wx.Size(16, 16)))
tree.AssignImageList(imglist)
# add columns
tree.AddColumn("Model")
tree.SetColumnWidth(0,300)
tree.AddColumn("Purchase Price")
# the root entry of our tree ctrl
root = tree.AddRoot("Products", 0)
#Read in the SQLITE database and create alist of models
z = OperateOnDatabase()
dictionary =
z.select_order('*','products','groupdescription','Produkt','model')
#define an empty list of models in the database and fill it
# NOTE: an easier aproach iss to read it all into a list and then
# eliminate doubles like this: onlysingles_model_list=set(model_list)
# resulting in a set *TO BE CHANGED*
model_list = []
for entry in dictionary:
if entry['model'] in model_list:
print '--- already in list ---'
print entry['model']
else:
model_list.append(entry['model'])
# define an emptly list for items and fill it
items = []
# run through the entire model list again and create the tree ctrl
structure
for item in dictionary2:
amount = wx.TextCtrl(tree.GetMainWindow(), -1, "", size=(20,20))
child =
tree.AppendItem(items[(len(items)-1)],item['description'],wnd=amount)
tree.SetItemText(child, u'€ ' + str('%10.2f' %
(item['purchaseprice'])),1)
Any suggestions? I am also free to use some other TreeCtrl that might
be better for the task ... I am stuck ...
Cheers,
S