[SOLVED] Exception: Not a displayable: None

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
MisterHarold
Regular
Posts: 51
Joined: Tue Jul 17, 2018 10:32 am
Location: Philippines
Contact:

[SOLVED] Exception: Not a displayable: None

#1 Post by MisterHarold »

I tried making a gallery for my Visual Novel but I encounter an error whenever I use an imagebutton instead of just a thumbnail.

Code: Select all

screen gallery:
    tag menu

    add "pink2.png"
    
    $start = gallery_page * maxperpage
    $end = min(start + maxperpage - 1, len(gallery_items) - 1)

    #grid for images
    grid maxnumx maxnumy:
        xfill True
        yfill True

        for i in range(start, end + 1):
            $gallery_items[i].refresh_lock()
            if gallery_items[i].is_locked:
                add gallery_items[i].locked:
                    xalign 0.5
                    yalign 0.5
            else:
                imagebutton idle gallery_items[i].thumb:
                    action Show("gallery_closeup", gallery_items[i].images)
                    xalign 0.5
                    yalign 0.5

        for i in range(end - start + 1,  maxperpage):
            null

    #grid for info
    grid maxnumx maxnumy:
        xfill True
        yfill True

        for i in range(start, end + 1):
            hbox:
                spacing maxthumbx - 70
                xalign 0.5
                yalign 0.1
                $total = gallery_items[i].num_images()
                $partial = gallery_items[i].num_unlocked
                text gallery_items[i].name
                text "[partial]/[total]"

        for i in range(end - start + 1, maxperpage):
            null


    #previous/next buttons
    if gallery_page > 0:
        textbutton "Previous":
            action SetVariable("gallery_page", gallery_page - 1)
            xalign 0.1
            yalign 0.98
    if (gallery_page + 1) * maxperpage < len(gallery_items):
        textbutton "Next":
            action SetVariable("gallery_page", gallery_page + 1)
            xalign 0.9
            yalign 0.98

    #return button
    textbutton "Back to Main Menu":
        action Return()
        xalign 0.5
        yalign 0.98

screen gallery_closeup(images):

    add images[closeup_page] at truecenter

    if closeup_page > 0:
        textbutton "Previous":
            action SetVariable("closeup_page", closeup_page - 1)
            xalign 0.1
            yalign 0.98
            background "black.png"
    if closeup_page < len(images) - 1:
        textbutton "Next":
            action SetVariable("closeup_page", closeup_page + 1)
            xalign 0.9
            yalign 0.98
            background "black.png"

    textbutton "Return":
        action [SetVariable("closeup_page", 0), Hide("gallery_closeup", dissolve)]
        xalign 0.5
        yalign 0.98
        background "black.png"
The code I think that's responsible:

Code: Select all

                imagebutton idle gallery_items[i].thumb:
                    action Show("gallery_closeup", gallery_items[i].images)
The error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/gallery.rpy", line 1, in execute
    screen gallery:
  File "game/gallery.rpy", line 10, in execute
    grid maxnumx maxnumy:
  File "game/gallery.rpy", line 14, in execute
    for i in range(start, end + 1):
  File "game/gallery.rpy", line 16, in execute
    if gallery_items[i].is_locked:
  File "game/gallery.rpy", line 21, in execute
    imagebutton idle gallery_items[i].thumb:
Exception: Not a displayable: None

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 29, in script
    $ ui.interact()
  File "C:\renpy-6.99.5-sdk\renpy\ast.py", line 797, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\renpy-6.99.5-sdk\renpy\python.py", line 1448, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 29, in <module>
    $ ui.interact()
  File "C:\renpy-6.99.5-sdk\renpy\ui.py", line 277, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\renpy-6.99.5-sdk\renpy\display\core.py", line 2296, in interact
    scene_lists.replace_transient()
  File "C:\renpy-6.99.5-sdk\renpy\display\core.py", line 674, in replace_transient
    self.remove(layer, tag)
  File "C:\renpy-6.99.5-sdk\renpy\display\core.py", line 961, in remove
    self.hide_or_replace(layer, remove_index, "hide")
  File "C:\renpy-6.99.5-sdk\renpy\display\core.py", line 885, in hide_or_replace
    d = oldsle.displayable._hide(now - st, now - at, prefix)
  File "C:\renpy-6.99.5-sdk\renpy\display\screen.py", line 430, in _hide
    self.update()
  File "C:\renpy-6.99.5-sdk\renpy\display\screen.py", line 565, in update
    self.screen.function(**self.scope)
  File "game/gallery.rpy", line 1, in execute
    screen gallery:
  File "game/gallery.rpy", line 10, in execute
    grid maxnumx maxnumy:
  File "game/gallery.rpy", line 14, in execute
    for i in range(start, end + 1):
  File "game/gallery.rpy", line 16, in execute
    if gallery_items[i].is_locked:
  File "game/gallery.rpy", line 21, in execute
    imagebutton idle gallery_items[i].thumb:
  File "C:\renpy-6.99.5-sdk\renpy\ui.py", line 914, in _imagebutton
    **properties)
  File "C:\renpy-6.99.5-sdk\renpy\display\behavior.py", line 843, in __init__
    hover_ = renpy.easy.displayable(hover_image),
  File "C:\renpy-6.99.5-sdk\renpy\easy.py", line 129, in displayable
    raise Exception("Not a displayable: %r" % (d,))
Exception: Not a displayable: None
I want my gallery to show imagebuttons instead of thumbs so when I click it, it would show the full CG. Any kind of help would be greatly appreciated.
Attachments
images.rpy
(576 Bytes) Downloaded 61 times
gallery_setup.rpy
(1.98 KiB) Downloaded 44 times
Last edited by MisterHarold on Tue Jul 17, 2018 11:59 pm, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Exception: Not a displayable: None

#2 Post by Per K Grok »

MisterHarold wrote: Tue Jul 17, 2018 10:59 am

Code: Select all

                imagebutton idle gallery_items[i].thumb:
                    action Show("gallery_closeup", gallery_items[i].images)
                    xalign 0.5
                    yalign 0.5
Shouldn't that be

Code: Select all

                imagebutton:
                    idle gallery_items[i].thumb
                    action Show("gallery_closeup", gallery_items[i].images)
                    xalign 0.5
                    yalign 0.5
?

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Exception: Not a displayable: None

#3 Post by MaydohMaydoh »

Where you append your images to gallery_items list,

Code: Select all

gallery_items.append(GalleryItem("Image 1", ["lostkei"], "thumb1"))
gallery_items.append(GalleryItem("Image 2", ["girlshadow"], "thumb2"))
gallery_items.append(GalleryItem("Image 3", ["gathering"], "thumb3"))
gallery_items.append(GalleryItem("Image 4", ["stars"], "thumb4"))
gallery_items.append(GalleryItem("Image 5", ["shake"], "thumb5"))
Shouldn't it be

Code: Select all

gallery_items.append(GalleryItem("Image 1", [ lostkei ], thumb1))
gallery_items.append(GalleryItem("Image 2", [ girlshadow ], thumb2))
gallery_items.append(GalleryItem("Image 3", [ gathering ], thumb3))
gallery_items.append(GalleryItem("Image 4", [ stars ], thumb4))
gallery_items.append(GalleryItem("Image 5", [ shake ], thumb5))
?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], barsunduk, Google [Bot]