[solved] Gallery Buttons

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
Kaen
Regular
Posts: 148
Joined: Tue Oct 16, 2012 10:49 pm
Contact:

[solved] Gallery Buttons

#1 Post by Kaen »

Is it possible to add gallery buttons with just an image as a displayable, like a imagebutton?

When I try to create a gallery button, the display I expect is like those gray rectangles, but instead the image is displayed arround something and I'd like to remove it.

Code: Select all

label init_gallery:
init python:        
    g = Gallery()    
    g.locked_button = "lock.png"    
    g.hover_border = "border_hover.png"    
    g.idle_border = "border_idle.png"
    g.transition = dissolve
    g.navigation = True        
    g.locked = True
    
    g.button("01")
    g.unlock_image("cg 01_1")
    g.unlock_image("cg 01_2")

screen gallery:
    tag menu    
    add g.make_button("01", "01_thumb.png", locked="01_locked.png", xpos=0.5, ypos=0.5)    
No border:
Image

Idle border:
Image

Hover border:
Image
Last edited by Kaen on Sat Jul 12, 2014 10:08 am, edited 1 time in total.

User avatar
Kaen
Regular
Posts: 148
Joined: Tue Oct 16, 2012 10:49 pm
Contact:

Re: Gallery Buttons

#2 Post by Kaen »

I got this fixed by adding style="default" on the button. Though that made the borders to not show anymore and I don't know from where this style came from.

Code: Select all

add g.make_button("01", "01_thumb.png", locked="01_locked.png", xpos=0.5, ypos=0.5, style="default")    

User avatar
Kaen
Regular
Posts: 148
Joined: Tue Oct 16, 2012 10:49 pm
Contact:

Re: Gallery Buttons

#3 Post by Kaen »

Sorry for the triple post, but I'd still like to know a way where I don't have to sacrifice the borders (using style="default") to make it work :(

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Gallery Buttons

#4 Post by Alex »

Gallery buttons are actually the buttons, so they have all the button's properties (try to set their paddings to 0 to get rid of "borders")

Code: Select all

add g.make_button("01", "01_thumb.png", locked="01_locked.png", xpos=0.5, ypos=0.5, xpadding=0, ypadding=0, background=None)
http://www.renpy.org/doc/html/style_pro ... properties

Or you could create your custom style to use it instead of "default" one in your code.
http://www.renpy.org/doc/html/style.htm ... -statement

User avatar
Kaen
Regular
Posts: 148
Joined: Tue Oct 16, 2012 10:49 pm
Contact:

Re: Gallery Buttons

#5 Post by Kaen »

Thank you Alex, that's exactly what I was looking for!

Post Reply

Who is online

Users browsing this forum: No registered users