How put color inside vbox/hbox

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
enzof2003
Newbie
Posts: 7
Joined: Fri Nov 09, 2018 6:04 pm
Contact:

How put color inside vbox/hbox

#1 Post by enzof2003 »

Hello and sorry if that question was maybe asked or answered. But i couldn't find any answers online. I'm trying to change the color, the font and the style (bold). But i couldn't find a way to do it :

Code: Select all

style inventory_label:
    xalign 0.2

style slot:
    background Frame("square", 0,0)
    minimum(80,80)
    maximum(80,80)
    xalign 0.5

screen inventory_screen:
    style_prefix "inventory"

    add "invbg.png"
    hbox:
        #characters detail/stats and stuff

        vbox:
            xmaximum 300
            spacing 10
            label "Character Details"
            label "Health Points:[pc.hp]/[pc.max_hp]"
            label "Magic Points : [pc.mp]/[pc.max_mp]"
            label "Attack : [pc.atk]"
            label "Physical Defense : [pc.defense]"
            label "Magic Defense : [pc.mdef]"

            frame:
                style "slot"
                if pc.weapon != None:
                    add pc.weapon.img
                else:
                    label "weapon" xalign 0.5 yalign 0.5 text_size 14
            frame:
                style "slot"
                if pc.armor["head"] != None:
                    add pc.armor["head"].img
                else:
                    label "head" xalign 0.5 yalign 0.5 text_size 14

            frame:
                style "slot"
                if pc.armor["chest"] !=None:
                    add pc.armor["chest"].img
                else:
                    label "head" xalign 0.5 yalign 0.5 text_size 14
            frame:
                style "slot"
                if pc.armor["acc"] != None:
                    add pc.armor["acc"].img
                else:
                    label "accessory" xalign 0.5 yalign 0.5 text_size 14


        #Inventory grid
        grid 10 7:
            yalign 0.2
            spacing 5
            for item in inventory:
                frame:
                    style "slot"
                    if isinstance(item, KeyItem):
                        add "bg keyitem"
                    imagebutton idle item.img action SetVariable ("selected_item", item)
            for i in range(len(inventory), 70):
                frame:
                    style "slot"




        #Items info/details
        vbox:
            spacing 10
            label "Current Item" xalign 0.5
            if selected_item != None:
                frame:
                    style "slot"
                    if isinstance(selected_item, KeyItem):
                        add "bg keyitem"
                    add selected_item.img
                label "Value: [selected_item.value]"
                if isinstance (selected_item, Consumable):
                    textbutton "Use" action Function(selected_item.use, pc)
                if isinstance (selected_item, Equipable):
                    textbutton "Equip" action Function(selected_item.equip, pc)




    textbutton "Return":
        action Return()
        xalign 0.5
        yalign 0.95
All tips are welcome

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: How put color inside vbox/hbox

#2 Post by Kia »


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

Re: How put color inside vbox/hbox

#3 Post by Alex »

Not sure, but try to rename style slot to inventory_slot
https://www.renpy.org/doc/html/screens. ... yle-prefix

Post Reply

Who is online

Users browsing this forum: No registered users