May-05-2019, 08:22 PM
I'm trying to put images into treeviews.
Why does the image file Part.png not show up in this treeview.
I've loaded the same image ( Part.png) to show in the window and that works OK. are there some prerequisites for images on treeviews?
Why does the image file Part.png not show up in this treeview.
I've loaded the same image ( Part.png) to show in the window and that works OK. are there some prerequisites for images on treeviews?
tupbomi = [tuple(row) for row in all_rows] # How may items in this BOM print(len(tupbomi)) numbomi = (len(tupbomi)) for nbi in range(0,(numbomi)): tupbomd=tupbomi[nbi] print(( str(nbi)) + ' ' + tupbomd[1] + ' ' + tupbomd[2] + ' ' + tupbomd[3]) img = tk.PhotoImage(file='resources/Part.png') # Check that image and path are correct by displaying on window window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file='resources/Part.png')) # OK image shows # This will be BOM if tupbomd[2]== 'D': nbi= tree1.insert("", nbi, str(nbi), text=tupbomd[3], image=img , values=(tupbomd[2], tupbomd[3], tupbomd[4])) tree1.insert(nbi, "end", str(nbi)+'.1', text=tupbomd[3], image=img , values=(tupbomd[2], tupbomd[3], tupbomd[4])) # This will be a part else: tree1.insert("", nbi, text=tupbomd[3], image=img, values=( tupbomd[2], tupbomd[3], tupbomd[4]))