Page 1 of 1

Imagebuttons and the 'New GUI' [SOLVED]

Posted: Thu Mar 02, 2017 2:27 pm
by twixx
No matter how hard I try, I can't put an imagebutton on my main menu screen.

If anyone has an idea what I might be doing wrong, please help!

Code: Select all

screen main_menu():
    
    imagebutton auto "mybutton_%s.png" xalign 1.0 yalign 0.9 action OpenURL("myURL")
I tried

Code: Select all

screen main_menu():
    
    vbox xalign 1.0 yalign 1.0:
        imagebutton auto "mybutton_%s.png" action OpenURL("myURL")
as I've seen it screen language documentation, but it doesn't work either.

This is what I get:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/screens.rpy", line 360, in execute
    screen main_menu():
  File "game/screens.rpy", line 360, in execute
    screen main_menu():
  File "game/screens.rpy", line 362, in execute
    vbox xalign 1.0 yalign 1.0:
  File "game/screens.rpy", line 363, in execute
    imagebutton auto "mybutton_%s.png" action OpenURL("myURL")
Exception: Not a displayable: None
(Of course I replaced button name and URL name in this post.)

Re: Imagebuttons and the 'New GUI'

Posted: Thu Mar 02, 2017 4:24 pm
by gas
The syntax is correct and I'm actually looking a released game code, with imagebuttons.

The only thing I would try is to change the name of files and syntax.
Something like "button idle" instead of "button_idle", and modify the code as "button %s.png" instead of "button_%s.png".

Also stating the directory can help (the code I'm looking for did it).
At least, that's what I'm seeing and it work.

Re: Imagebuttons and the 'New GUI'

Posted: Fri Mar 03, 2017 1:27 am
by twixx
Thanks, it was a problem with the directory. Strange, as with some other images it works if I don't state the directory. (backgrounds, overlays)

I just put them in the root images folder and it worked.