Bonjour à tous,

Je souhaite afficher l'icone du programme associer a une extension précise dans un widget treeview, par exemple l'extention avi. Pour cela j'ai récupérer un certain code qui utilise la librairie win32, le problème c'est qu'il est destiner a wxPython. Il n'y as que la partie récupération de l'icone a adapter mais ça dépasse mes compétences, quelqu'un saurait-il comment procéder ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import tkinter
from win32com.shell import shell, shellcon
from win32con import FILE_ATTRIBUTE_NORMAL
 
def extension_to_bitmap(extension):
    """dot is mandatory in extension"""
 
    flags = shellcon.SHGFI_SMALLICON | \
            shellcon.SHGFI_ICON | \
            shellcon.SHGFI_USEFILEATTRIBUTES
 
    retval, info = shell.SHGetFileInfo(extension,
                             FILE_ATTRIBUTE_NORMAL,
                             flags)
    # non-zero on success
    assert retval
 
    hicon, iicon, attr, display_name, type_name = info
 
    # Get the bitmap
    icon = wx.EmptyIcon()
    icon.SetHandle(hicon)
    return wx.BitmapFromIcon(icon)
Merci.