Ren'Py Image displayed in notification

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,689
What you are looking for is :
[Note: I can't test right now, so the code is given "as it"]
Python:
screen notifyExInternal( n ):
[...]
            if not n.img is None:
                add im.Scale( n.img, gui.notifyEx_width, gui.notifyEx_height )
But that will force the icon to now have dimensions not necessarily proportional to the original size. So, if it's a problem, use the fact that I don't enforce the type for the NotifyEx parameters :
Python:
image iconThis = im.Scale( "images/icons/this.jpg", 100, 90 )
[...]
label blabla:
    $ notifyEx( msg="something", img=iconThis )



The problem with notifyExClean here is that you need to provide the value to remove. It can be done by enumerating the list :
Python:
for a in notifications:
    notifyExClean( a )
but it's too much for such a thing. Just reset the list and it's good :
Python:
init python:

    def notifyExPurge():
        store.notifications = []
        renpy.hide_screen( "notifyEx" )

[...]
label blabla:
[...]
    "Pfff, we are still alive"
    $ notifyExPurge()
    "Yeah, it was close this time"
All worked like a charm :)

Finally I used the option to define the image in order to better control the height and width.

Thank you very much!!!
 
  • Like
Reactions: anne O'nymous