Hello there,
Recently i have been trying to display some images on the screen within a menulist, i discovered that the images wouldn't display inside the menulist but any text i added would. I then tried putting a different image into the menulist and this image appeared to work fine.
I then thought that my png image might have been in the wrong format, so i tried drawing it as a Pixmap on the screen and the image draws fine...so why does it not display inside a multicontententry menu list?
Here is some code i have been working on:
def DecodePicture(self, PicInfo = ""):
#we tell a pointer to equal the data of the picture from PicLoad, we will need this when decoding the picture we want
ptr = self.PicLoad.getData()
#now we can begin adding our data from lists to our labels, everytime DecodePicture is called the Pindex will be different, i.e. a different picture from the different feeds
#we then tell an element of chartpic to set it's pixmap to the pointer. Notice that we decide which feedpic to use depending on what picturecounter equals and notice we set the instance. This is because when we created it we declared it as a widget, not specifically a Pixmap object until object assignment i.e. self["feed"] = Pixmap()
self["feedpic"].instance.setPixmap(ptr)
def ok(self):
#now that we have our picPath we can start to decode the picture and load it on screen
self.PicLoad.startDecode("/tmp/1.png")
png = LoadPixmap("/tmp/1.png")
res = []
#we then make our png a set size (this is the size of each item in menulist) and we draw it at the position within the menu list shown e.g. 10,0
res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(270, 25), png=png ))
#we then make our png 270 by 25 (this is the size of each item in menulist) and we draw it at the position within the menu list shown e.g. 10,0
#once our image has been drawn we then draw text in a similar way, instead we allow text to be drawn for each item saying "hello", note the position of the x-axis on the text compared to picture
res.append(MultiContentEntryText(pos=(280, 0), size=(125, 25), font=0, flags = RT_HALIGN_LEFT, text="hello", color=0x00FFFFFF, color_sel=0x00FFFFFF))
self.events.append(res)
#lastly we call fillmytext
self.fillmytxt()
def fillmytxt(self):
#when fillmytxt is called we aupply mylist with the contents of self.events, this list is what held all of the information to go into our menulist
self["mylist"].l.setList(self.events)
self['mylist'].show()
Alles anzeigen
ok so basically i press the ok button and the image i wish to show inside the menulist along side the text saying "hello" is displayed inside the Pixmap "feedpic" but not inside the menulist. Can anybody figure out how i could also get this image displayed inside the menulist?
Thanks