CG Gallery error [SOLVED]

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
User avatar
rusicaria
Regular
Posts: 51
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

CG Gallery error [SOLVED]

#1 Post by rusicaria » Sat May 01, 2021 1:55 pm

Hello,

I've attempted to make a CG gallery in my game, and I got this error when I clicked on the gallery in-game:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00gamemenu.rpy", line 173, in script
    $ ui.interact()
  File "renpy/common/00gamemenu.rpy", line 173, in <module>
    $ ui.interact()
Exception: Grid not completely full.

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

Full traceback:
  File "renpy/common/00gamemenu.rpy", line 173, in script
    $ ui.interact()
  File "renpy/ast.py", line 922, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "renpy/python.py", line 2218, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/00gamemenu.rpy", line 173, in <module>
    $ ui.interact()
  File "renpy/ui.py", line 298, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3101, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "renpy/display/core.py", line 3512, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "renpy/display/core.py", line 567, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 567, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 567, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 567, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/screen.py", line 437, in visit_all
    self.child.visit_all(callback, seen=None)
  File "renpy/display/core.py", line 567, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 569, in visit_all
    callback(self)
  File "renpy/display/core.py", line 3512, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "renpy/display/layout.py", line 526, in per_interact
    raise Exception("Grid not completely full.")
Exception: Grid not completely full.
This is the code that I tried using from the renpy website:

Code: Select all

init python:
    g = Gallery()

    g.button("thielart1")
    g.condition("persistent.thielart1")
    g.image("thielart1.jpg")

    g.button("jaylaart1")
    g.condition("persistent.jaylaart1")
    g.image("jaylaart1.jpg")

    g.button("crisart1")
    g.condition("persistent.crisart1")
    g.image("crisart1.jpg")

    g.button("eliorart1")
    g.condition("persistent.eliorart1")
    g.image("eliorart1.jpg")

screen gallery2:

    tag menu

    add "backgroundmenu.jpg"

    grid 4 4:
        
        xfill True
        yfill True

        add g.make_button("thielart1","thielart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)
        add g.make_button("jaylaart1", "jaylaart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)
        add g.make_button("crisart1", "crisart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)
        add g.make_button("eliorart1", "eliortart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)

        textbutton "Previous" action ShowMenu("gallery") xalign 0.5 yalign 0.5
        textbutton "Next" action ShowMenu("gallery3") xalign 0.5 yalign 0.5
        textbutton "Return" action Return() xalign 0.5 yalign 0.5
I'm relatively new to coding, I'd appreciate any help! :(
Last edited by rusicaria on Thu May 06, 2021 3:04 pm, edited 3 times in total.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1072
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: CG Gallery error

#2 Post by Ocelot » Sat May 01, 2021 2:10 pm

grid 4 4: 4×4=16. You have stated that there would be 16 displayables in the grid. You have supplied only 7. Hence "Exception: Grid not completely full.".
< < insert Rick Cook quote here > >

User avatar
rusicaria
Regular
Posts: 51
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: CG Gallery error

#3 Post by rusicaria » Sat May 01, 2021 2:32 pm

Ocelot wrote:
Sat May 01, 2021 2:10 pm
grid 4 4: 4×4=16. You have stated that there would be 16 displayables in the grid. You have supplied only 7. Hence "Exception: Grid not completely full.".
Oh I see, how should I fix this? I haven't made all of the CGS's yet, only 4 out of the intended 40

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1072
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: CG Gallery error

#4 Post by Ocelot » Sat May 01, 2021 3:34 pm

You can use Null() displayable as "no displayable" placeholder: https://www.renpy.org/doc/html/displayables.html#Null
< < insert Rick Cook quote here > >

User avatar
rusicaria
Regular
Posts: 51
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: CG Gallery error

#5 Post by rusicaria » Sat May 01, 2021 8:23 pm

Ocelot wrote:
Sat May 01, 2021 3:34 pm
You can use Null() displayable as "no displayable" placeholder: https://www.renpy.org/doc/html/displayables.html#Null
I'm really sorry, how do I code this/do this? I tried pasting it and changing it but it didn't really work.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1072
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: CG Gallery error

#6 Post by Ocelot » Sun May 02, 2021 2:49 am

Code: Select all

    grid 4 4:
        add g.make_button("thielart1","thielart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 1
        add g.make_button("jaylaart1", "jaylaart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 2
        add g.make_button("crisart1", "crisart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 3
        add g.make_button("eliorart1", "eliortart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  #4
        add Null()  # 5
        add Null() # 6
    # And so on.
< < insert Rick Cook quote here > >

User avatar
rusicaria
Regular
Posts: 51
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: CG Gallery error

#7 Post by rusicaria » Sun May 02, 2021 8:42 am

Ocelot wrote:
Sun May 02, 2021 2:49 am

Code: Select all

    grid 4 4:
        add g.make_button("thielart1","thielart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 1
        add g.make_button("jaylaart1", "jaylaart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 2
        add g.make_button("crisart1", "crisart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 3
        add g.make_button("eliorart1", "eliortart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  #4
        add Null()  # 5
        add Null() # 6
    # And so on.
So I tried that, and now it's coming up with this? I've tried moving it in and out of the game folder and switching between .png and .jpg.
When this isn't here it's showing that the grid isn't completely full or it's overfilled. I'm not sure what I'm doing wrong :cry:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While loading <'Image' u'game_menu.png'>:
  File "renpy/common/00gamemenu.rpy", line 173, in script
    $ ui.interact()
  File "renpy/common/00gamemenu.rpy", line 173, in <module>
    $ ui.interact()
IOError: Couldn't find file 'game_menu.png'.

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

Full traceback:
  File "renpy/common/00gamemenu.rpy", line 173, in script
    $ ui.interact()
  File "renpy/ast.py", line 922, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "renpy/python.py", line 2218, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/00gamemenu.rpy", line 173, in <module>
    $ ui.interact()
  File "renpy/ui.py", line 298, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3101, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "renpy/display/core.py", line 3611, in interact_core
    self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
  File "renpy/display/core.py", line 2441, in draw_screen
    renpy.config.screen_height,
  File "render.pyx", line 492, in renpy.display.render.render_screen
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 777, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/transition.py", line 368, in render
    top = render(self.new_widget, width, height, st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 777, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 777, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/screen.py", line 681, in render
    child = renpy.display.render.render(self.child, w, h, st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 777, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/im.py", line 607, in render
    return cache.get(self, render=True)
  File "renpy/display/im.py", line 271, in get
    surf = image.load()
  File "renpy/display/im.py", line 688, in load
    raise e
IOError: Couldn't find file 'game_menu.png'.


User avatar
rusicaria
Regular
Posts: 51
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: CG Gallery error

#8 Post by rusicaria » Sun May 02, 2021 8:47 am

Ocelot wrote:
Sun May 02, 2021 2:49 am

Code: Select all

    grid 4 4:
        add g.make_button("thielart1","thielart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 1
        add g.make_button("jaylaart1", "jaylaart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 2
        add g.make_button("crisart1", "crisart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 3
        add g.make_button("eliorart1", "eliortart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  #4
        add Null()  # 5
        add Null() # 6
    # And so on.
So I tried that, and now it's coming up with this? I've tried moving it in and out of the game folder and switching between .png and .jpg.
When this isn't here it's showing that the grid isn't completely full or it's overfilled. I'm not sure what I'm doing wrong :cry:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While loading <'Image' u'game_menu.png'>:
  File "renpy/common/00gamemenu.rpy", line 173, in script
    $ ui.interact()
  File "renpy/common/00gamemenu.rpy", line 173, in <module>
    $ ui.interact()
IOError: Couldn't find file 'game_menu.png'.

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

Full traceback:
  File "renpy/common/00gamemenu.rpy", line 173, in script
    $ ui.interact()
  File "renpy/ast.py", line 922, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "renpy/python.py", line 2218, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/00gamemenu.rpy", line 173, in <module>
    $ ui.interact()
  File "renpy/ui.py", line 298, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3101, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "renpy/display/core.py", line 3611, in interact_core
    self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
  File "renpy/display/core.py", line 2441, in draw_screen
    renpy.config.screen_height,
  File "render.pyx", line 492, in renpy.display.render.render_screen
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 777, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/transition.py", line 368, in render
    top = render(self.new_widget, width, height, st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 777, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 777, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/screen.py", line 681, in render
    child = renpy.display.render.render(self.child, w, h, st, at)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/layout.py", line 777, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 170, in renpy.display.render.render
  File "render.pyx", line 263, in renpy.display.render.render
  File "renpy/display/im.py", line 607, in render
    return cache.get(self, render=True)
  File "renpy/display/im.py", line 271, in get
    surf = image.load()
  File "renpy/display/im.py", line 688, in load
    raise e
IOError: Couldn't find file 'game_menu.png'.
This is what I've got right now.

Code: Select all

init python:
    g = Gallery()

    g.button("thielart1")
    g.condition("persistent.thielart1")
    g.image("thielart1.jpg")

    g.button("jaylaart1")
    g.condition("persistent.jaylaart1")
    g.image("jaylaart1.jpg")

    g.button("crisart1")
    g.condition("persistent.crisart1")
    g.image("crisart1.jpg")

    g.button("eliorart1")
    g.condition("persistent.eliorart1")
    g.image("eliorart1.jpg")

screen gallery2:

    tag menu

    add "game_menu.png"

    grid 4 4:
        add g.make_button("thielart1","thielart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 1
        add g.make_button("jaylaart1", "jaylaart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 2
        add g.make_button("crisart1", "crisart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  # 3
        add g.make_button("eliorart1", "eliortart1.jpg", locked = "lock.png", xalign=0.5, yalign=0.5)  #4
        add Null()  
        add Null()  
        add Null()
        add Null()  
        add Null()
        add Null()  
        add Null()
        add Null()  
        add Null()
I'm so sorry that I keep coming back, I really don't want to give up on this.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1072
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: CG Gallery error

#9 Post by Ocelot » Sun May 02, 2021 9:33 am

I would place image in the images directory and double check the name. And if it has double extention or not.
Because this:
Image
could actually be this:
Image

And check if grind has exactly 16 children, including textbutton, which in your case were part of the grid too.
< < insert Rick Cook quote here > >

User avatar
rusicaria
Regular
Posts: 51
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: CG Gallery error

#10 Post by rusicaria » Mon May 03, 2021 2:01 pm

Ocelot wrote:
Sun May 02, 2021 9:33 am
I would place image in the images directory and double check the name. And if it has double extention or not.
Because this:
Image
could actually be this:
Image

And check if grind has exactly 16 children, including textbutton, which in your case were part of the grid too.
I managed to sort out the background and kind of the cg's. The main problem right now is that whenever I click onto a cg there's a smaller version of it at the bottom center. Is there a way to get rid of this? And also I assume I have to make more gallery's if I want to navigate between the previous and next buttons, but when I get rid of this it says that the grid isn't completely full again.

Also I'm trying to move the cg's around by adjusting the xalign's and yalign's but it isn't changing anything...
Screenshot 2021-05-03 19.42.40.png
Screenshot 2021-05-03 19.42.17.png
This is what I'm looking at. I'm trying to move the 4 cg's into the middle 2X2 square but nothing is changing.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1072
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: CG Gallery error

#11 Post by Ocelot » Wed May 05, 2021 4:34 am

rusicaria wrote:
Mon May 03, 2021 2:01 pm
I managed to sort out the background and kind of the cg's. The main problem right now is that whenever I click onto a cg there's a smaller version of it at the bottom center. Is there a way to get rid of this?
I am not really familiar with gallery. It is possible that you are supposed to press 'H' to hide interface there.
rusicaria wrote:
Mon May 03, 2021 2:01 pm
but when I get rid of this it says that the grid isn't completely full again.
Make sure that whatever you get rid of from the grid is replaced with something
rusicaria wrote:
Mon May 03, 2021 2:01 pm
Also I'm trying to move the cg's around by adjusting the xalign's and yalign's but it isn't changing anything...
This is what I'm looking at. I'm trying to move the 4 cg's into the middle 2X2 square but nothing is changing.
This is because grid separates screnn into... grid: 16 small windows where other displayables can be drawn. Element positioning is relative to these windows. If you want images to be in the center square, you need to place them there first. If you draw 4x4 grid and count slots it would be slots 6, 7, 10, 11. Your grid would look like:

Code: Select all

add Null()
add Null()
add Null()
add Null()
add Null()
add button
add button
add Null()
add Null()
add button
...
< < insert Rick Cook quote here > >

User avatar
rusicaria
Regular
Posts: 51
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: CG Gallery error

#12 Post by rusicaria » Wed May 05, 2021 11:12 am

Ocelot wrote:
Wed May 05, 2021 4:34 am
rusicaria wrote:
Mon May 03, 2021 2:01 pm
I managed to sort out the background and kind of the cg's. The main problem right now is that whenever I click onto a cg there's a smaller version of it at the bottom center. Is there a way to get rid of this?
I am not really familiar with gallery. It is possible that you are supposed to press 'H' to hide interface there.
rusicaria wrote:
Mon May 03, 2021 2:01 pm
but when I get rid of this it says that the grid isn't completely full again.
Make sure that whatever you get rid of from the grid is replaced with something
rusicaria wrote:
Mon May 03, 2021 2:01 pm
Also I'm trying to move the cg's around by adjusting the xalign's and yalign's but it isn't changing anything...
This is what I'm looking at. I'm trying to move the 4 cg's into the middle 2X2 square but nothing is changing.
This is because grid separates screnn into... grid: 16 small windows where other displayables can be drawn. Element positioning is relative to these windows. If you want images to be in the center square, you need to place them there first. If you draw 4x4 grid and count slots it would be slots 6, 7, 10, 11. Your grid would look like:

Code: Select all

add Null()
add Null()
add Null()
add Null()
add Null()
add button
add button
add Null()
add Null()
add button
...
AH I see now! When you explained how the gallery worked this way I completely got it! I managed to get the CGs in the center and everything! Thank you SO MUCH for your help, and I'm really sorry that it took so long for me to figure out!

User avatar
rusicaria
Regular
Posts: 51
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: CG Gallery error

#13 Post by rusicaria » Wed May 05, 2021 12:40 pm

---> ended up realising that the button .png's and the cg's had to be inside the image folder for this to work.
Attachments
Screenshot 2021-05-05 17.39.31.png

Post Reply

Who is online

Users browsing this forum: Google [Bot], henvu50