{Solved} Imagebutton Shenanigans! {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
terrordoll
Regular
Posts: 46
Joined: Tue Apr 11, 2017 11:57 am
Contact:

{Solved} Imagebutton Shenanigans! {Solved}

#1 Post by terrordoll »

I was able to get some really helpful answers to my questions yesterday, I'm very close to having my map screen and UI buttons all working. Well, I would be close if I could get these image buttons to work.

Here is my screen

Code: Select all

screen gameui():
    frame:
        xsize 1920
        ysize 200
        xpos 0
        ypos 0
        
        imagebutton auto "gui/mapicon_%s.png" action ShowMenu('preferences') xpos 690 ypos 390 focus_mask True
I have both a mapicon_idle and mapicon_hover in my gui folder. but I keep getting this error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 44, in script
    diary "Hey Diary, it's me Amber."
  File "renpy/common/000window.rpy", line 98, in _window_auto_callback
    _window_show()
  File "renpy/common/000window.rpy", line 60, in _window_show
    renpy.with_statement(trans)
  File "game/screens.rpy", line 1318, in execute
    screen gameui():
  File "game/screens.rpy", line 1318, in execute
    screen gameui():
  File "game/screens.rpy", line 1319, in execute
    frame:
  File "game/screens.rpy", line 1325, in execute
    imagebutton auto "gui/mapicon_%s.png" action ShowMenu('preferences') xpos 690 ypos 390 focus_mask True
Exception: Not a displayable: None

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

Full traceback:
  File "game/script.rpy", line 44, in script
    diary "Hey Diary, it's me Amber."
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\ast.py", line 587, in execute
    statement_name("say")
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\ast.py", line 43, in statement_name
    i(name)
  File "renpy/common/000window.rpy", line 98, in _window_auto_callback
    _window_show()
  File "renpy/common/000window.rpy", line 60, in _window_show
    renpy.with_statement(trans)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\exports.py", line 1381, in with_statement
    return renpy.game.interface.do_with(trans, paired, clear=clear)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2096, in do_with
    clear=clear)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2526, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2793, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 399, in visit_all
    callback(self)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2793, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 409, in per_interact
    self.update()
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 578, in update
    self.screen.function(**self.scope)
  File "game/screens.rpy", line 1318, in execute
    screen gameui():
  File "game/screens.rpy", line 1318, in execute
    screen gameui():
  File "game/screens.rpy", line 1319, in execute
    frame:
  File "game/screens.rpy", line 1325, in execute
    imagebutton auto "gui/mapicon_%s.png" action ShowMenu('preferences') xpos 690 ypos 390 focus_mask True
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\ui.py", line 928, in _imagebutton
    **properties)
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\display\behavior.py", line 946, in __init__
    idle_=renpy.easy.displayable(idle_image),
  File "C:\Users\devin.morrow\Desktop\renpy-6.99.12.4-sdk\renpy\easy.py", line 108, in displayable
    raise Exception("Not a displayable: %r" % (d,))
Exception: Not a displayable: None

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
The Island 1.0
I feel like I'm missing a parameter but I have no idea which one and the documentation doesn't seem to indicate what is necessary and what is not. I took the imagebutton declaration from the imagebutton demo project, so I'm not sure why it's not working. I havent dug into styles yet so I guess it possible I'm missing some thing there. Here's the code as defined in the demo screens.rpy

Code: Select all

#begin quick_menu3
screen quick_menu3:
    imagebutton auto "gui/quick_config_%s.png" action ShowMenu('preferences') xpos 690 ypos 390 focus_mask True
    imagebutton auto "gui/quick_save_%s.png" action ShowMenu('save') xpos 760 ypos 390 focus_mask True
    imagebutton auto "gui/quick_load_%s.png"action ShowMenu('load') xpos 830 ypos 390 focus_mask True
    imagebutton auto "gui/quick_main_%s.png" action MainMenu() xpos 900 ypos 390 focus_mask True
#end quick_menu3
Any help you can offer is appreciated!
Last edited by terrordoll on Fri Apr 28, 2017 2:43 pm, edited 1 time in total.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Imagebutton Shenanigans!

#2 Post by trooper6 »

You have both a mapicon_hover and a mapicon_idle in your GUI folder. Are they both png files? They aren't jpgs or gifs, right?

If all of that is true, attach your project to this thread so that people can look at your whole project and see if the error is somewhere else.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

terrordoll
Regular
Posts: 46
Joined: Tue Apr 11, 2017 11:57 am
Contact:

Re: Imagebutton Shenanigans!

#3 Post by terrordoll »

trooper6 wrote:You have both a mapicon_hover and a mapicon_idle in your GUI folder. Are they both png files? They aren't jpgs or gifs, right?

If all of that is true, attach your project to this thread so that people can look at your whole project and see if the error is somewhere else.
I found the issue. Your reply made me second guess whether the images were set up correctly. Turns out there was a space between mapicon_idle and .png but I didn't see it because the file name was wrapping right at that point. I was thinking maybe there was a problem with the image export, so I looked at the image file details and saw the space in the name because it was written out in a single line.

Sorry to bother you, thanks for taking the time to reply.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]