[SOLVED] how can I adjust the ypos for a saveslot thumbnail?

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
Ekamu
Regular
Posts: 130
Joined: Mon Aug 12, 2013 9:13 am
Completed: Paper Guitar
Location: Lucid Moon
Contact:

[SOLVED] how can I adjust the ypos for a saveslot thumbnail?

#1 Post by Ekamu »

Hi guys, Its been a while and I'm getting back into Renpy and even working on another visual novel, anyway I was going through the GUI customization in the documentation and I am at Save_Slot buttons. I am trying to just slightly move the thumbnails (screenshot images) down a little so they can fit into the save_slot images and it seems there is no way to adjust the ypos or yalign of a thumbnail. Do I have to write a custom style or call "Slot" and define something or what? Its a minor issue I know but its been bothering me for the past day or two.

Here is a screenshot incase you don't know what Im talking about...
screenshot_saves.png
define config.thumbnail_width and define config.thumbnail_height work fine but I want to actually offset the thumbnail down just by like 3 pixels, not change the width and height. It seems that's impossible or at least it's not a simple thing to do.
Last edited by Ekamu on Sun May 31, 2020 6:10 am, edited 1 time in total.
------------Paper Guitar------------
Image
Experimental Nostalgic Romance VN Out Now!
.......made with love from the lucid moon........

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: how can I adjust the ypos for a saveslot thumbnail?

#2 Post by Per K Grok »

Ekamu wrote: Sat May 30, 2020 1:59 pm ----

define config.thumbnail_width and define config.thumbnail_height work fine but I want to actually offset the thumbnail down just by like 3 pixels, not change the width and height. It seems that's impossible or at least it's not a simple thing to do.
Try this in screens.rpy under screen file_slots(title)

Code: Select all

style slot_button:
    properties gui.button_properties("slot_button")
    ypos 3

User avatar
Ekamu
Regular
Posts: 130
Joined: Mon Aug 12, 2013 9:13 am
Completed: Paper Guitar
Location: Lucid Moon
Contact:

Re: how can I adjust the ypos for a saveslot thumbnail?

#3 Post by Ekamu »

Here is the entire screen file_slots(title) from screens.rpy, scroll to the bottom where I added ypos 10 however it seems not to work. The game runs and everything works but the code seems not to do anything even with a large number like 10 pixels. I'm I placing this in the wrong location?

Code: Select all

screen file_slots(title):
        
    default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))

    use game_menu(title):

        fixed:

            ## This ensures the input will get the enter event before any of the
            ## buttons do.
            order_reverse True

            ## The page name, which can be edited by clicking on a button.
            button:
                style "page_label"

                key_events True
                xalign 0.5
                action page_name_value.Toggle()

                input:
                    style "page_label_text"
                    value page_name_value

            ## The grid of file slots.
            grid gui.file_slot_cols gui.file_slot_rows:
                style_prefix "slot"

                xalign 0.5
                yalign 0.5

                spacing gui.slot_spacing

                for i in range(gui.file_slot_cols * gui.file_slot_rows):

                    $ slot = i + 1

                    button:
                        action FileAction(slot)

                        has vbox

                        add FileScreenshot(slot) xalign 0.5 

                        text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
                            style "slot_time_text"

                        text FileSaveName(slot):
                            style "slot_name_text"

                        key "save_delete" action FileDelete(slot)

            ## Buttons to access other pages.
            hbox:
                style_prefix "page"

                xalign 0.5
                yalign 1.0

                spacing gui.page_spacing

                textbutton _("<") action FilePagePrevious()

                if config.has_autosave:
                    textbutton _("{#auto_page}A") action FilePage("auto")

                if config.has_quicksave:
                    textbutton _("{#quick_page}Q") action FilePage("quick")

                ## range(1, 10) gives the numbers from 1 to 9.
                for page in range(1, 10):
                    textbutton "[page]" action FilePage(page)

                textbutton _(">") action FilePageNext()


style page_label is gui_label
style page_label_text is gui_label_text
style page_button is gui_button
style page_button_text is gui_button_text

style slot_button is gui_button
style slot_button_text is gui_button_text
style slot_time_text is slot_button_text
style slot_name_text is slot_button_text

style page_label:
    xpadding 50
    ypadding 3

style page_label_text:
    text_align 0.5
    layout "subtitle"
    hover_color gui.hover_color

style page_button:
    properties gui.button_properties("page_button")

style page_button_text:
    properties gui.button_text_properties("page_button")

style slot_button:
    properties gui.button_properties("slot_button")
    ypos 10

style slot_button_text:
    properties gui.button_text_properties("slot_button")
If you don't see it, above style slot_button_text: is your code. I tried ypos 10.

Code: Select all

style slot_button:
    properties gui.button_properties("slot_button")
    ypos 10
Thanks for your help.
------------Paper Guitar------------
Image
Experimental Nostalgic Romance VN Out Now!
.......made with love from the lucid moon........

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: how can I adjust the ypos for a saveslot thumbnail?

#4 Post by Per K Grok »

Ekamu wrote: Sun May 31, 2020 3:18 am Here is the entire screen file_slots(title) from screens.rpy, scroll to the bottom where I added ypos 10 however it seems not to work. The game runs and everything works but the code seems not to do anything even with a large number like 10 pixels. I'm I placing this in the wrong location?

-----

It is the right location.

It did work for me. I don't see any obvious reason why it should not work for your code as well.

I'll take a closer look a bit later and see if I can figure this out.

User avatar
Ekamu
Regular
Posts: 130
Joined: Mon Aug 12, 2013 9:13 am
Completed: Paper Guitar
Location: Lucid Moon
Contact:

Re: how can I adjust the ypos for a saveslot thumbnail?

#5 Post by Ekamu »

I've found a work around. I adjusted the borders to get the desired result.

Code: Select all

## The save slot button in gui.rpy.
define gui.slot_button_borders = Borders(10, 18, 10, 18)
screenshot_saves_fixed.png
I think this might be a little simpler than trying to adjust the screen.rpy itself but It forces the image to sort of shrink or stretch to fit the right position instead of actually moving it down by pixels. I think later on I will need to understand how to adjust the screens.rpy but for now this will do. However if you do find a way later, please share.
------------Paper Guitar------------
Image
Experimental Nostalgic Romance VN Out Now!
.......made with love from the lucid moon........

Post Reply

Who is online

Users browsing this forum: Google [Bot]