Imagebuttons and the 'New GUI' [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
twixx
Newbie
Posts: 12
Joined: Mon Jan 09, 2017 2:25 pm
Contact:

Imagebuttons and the 'New GUI' [SOLVED]

#1 Post by twixx » Thu Mar 02, 2017 2:27 pm

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.)
Last edited by twixx on Fri Mar 03, 2017 1:28 am, edited 1 time in total.

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Imagebuttons and the 'New GUI'

#2 Post by gas » Thu Mar 02, 2017 4:24 pm

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.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

twixx
Newbie
Posts: 12
Joined: Mon Jan 09, 2017 2:25 pm
Contact:

Re: Imagebuttons and the 'New GUI'

#3 Post by twixx » Fri Mar 03, 2017 1:27 am

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.

Post Reply

Who is online

Users browsing this forum: Google [Bot]