Wie resize ich Bilder aus einer ImageList?
Verfasst: Freitag 26. Mai 2006, 12:18
Hallo zusammen.
Für mein DOSBox Frontend möchte ich die Möglichkeit bieten die erfassten Konfigurationen als Icons oder als Liste (report mode) darzustellen.
Im Icon Mode wird ein 48x48 Pixel grosses gif benutzt. Im report Mode sollte das selbe Bild aber nur noch 16x16 Pixel gross sein. Die Frage ist nun, wie kann ich die ImageList der Icons mit den 48x48 Pixel grossen Bildern verwenden, so dass bei der Liste im report mode das Icon nur 16x16 Pixel gross ist?
Im Moment verwende ich wx.Bitmap um die ImageList zu erstellen:
Hat mir jemand einen Tipp?
Lieber Gruss
STiGMaTa
Für mein DOSBox Frontend möchte ich die Möglichkeit bieten die erfassten Konfigurationen als Icons oder als Liste (report mode) darzustellen.
Im Icon Mode wird ein 48x48 Pixel grosses gif benutzt. Im report Mode sollte das selbe Bild aber nur noch 16x16 Pixel gross sein. Die Frage ist nun, wie kann ich die ImageList der Icons mit den 48x48 Pixel grossen Bildern verwenden, so dass bei der Liste im report mode das Icon nur 16x16 Pixel gross ist?
Im Moment verwende ich wx.Bitmap um die ImageList zu erstellen:
Code: Alles auswählen
# Icon List
self.IconDict=dict()
self.TabIcons = wx.ListCtrl(self.notebookGames, -1, style=wx.LC_ICON|wx.SUNKEN_BORDER|wx.LC_AUTOARRANGE)
self.IconList = wx.ImageList(48, 48, True)
if not len(conf.FrodoProfiles.sections()) == 0:
self.PopulateIconList()
self.TabIcons.AssignImageList(self.IconList, wx.IMAGE_LIST_NORMAL)
self.PopulateTabList()
# Icon List end
[...]
def PopulateIconList(self):
self.ProfileSectionNames = conf.FrodoProfiles.sections()
self.ProfileSectionNames.sort()
for a in range(len(conf.FrodoProfiles.sections())):
SectionName = self.ProfileSectionNames[a]
IconPath = conf.FrodoProfiles.get(SectionName, 'icon')
bmp = wx.Bitmap(IconPath, wx.BITMAP_TYPE_ANY)
self.IconMax = self.IconList.Add(bmp)
self.IconDict[SectionName] = a
def PopulateTabList(self):
for a in range(len(conf.FrodoProfiles.sections())):
img = self.IconDict.has_key(self.ProfileSectionNames[a])
self.TabIcons.InsertImageStringItem(a,self.ProfileSectionNames[a],self.IconDict[self.ProfileSectionNames[a]])
Lieber Gruss
STiGMaTa