I'm working on a gallery. I want it to be the same kind as the "Save" and "Load" screen. Here's what I made so far:
Code: Select all
init python:
images_list = ["Ezekiel_2000s_anime_still_visual_novel_background_background_as_4a9ce919-08ea-4f21-b735-888b764b29ed.png","Ezekiel_2000s_anime_still_visual_novel_background_background_as_5a949abb-2e85-4c2a-b8fa-f3cda563b848.png","Bedroom (Anime Background) 007.jpeg"]
current_images_index = 0
selected_image = None # Reset the selected image when the screen is shown
for image in images_list:
scaled_thumbnail = im.Scale(image, 414, 309)
def set_selected_image(image):
global selected_image
selected_image = image
screen gallery_slots(title):
default page_name_value = FilePageNameInputValue(pattern=_("Page {}"))
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):
if i < len(images_list):
$ image_file = im.Scale(images_list[i], 384, 216)
$ image_big = im.Scale(images_list[i], 1760, 990)
button:
action [Function(set_selected_image, image_big), Show("image_bigger")]
add Image(image_file)
else:
add "gui/Lock_mini copie.png"
## Buttons to access other pages.
hbox:
style_prefix "page"
xalign 0.5
yalign 1.0
spacing gui.page_spacing
textbutton _("<") action FilePagePrevious()
for page in range(1, 10):
textbutton "[page]" action FilePage(page)
textbutton _(">") action FilePageNext()
How do I fix that? Thank you!!