I want choice boxs to be on the right and left.
If they were four, they would put two down on the left and right.
I do not know much about programming, so if you can give a simple explanation. Thankful
Code: Select all
vbox:
for i in items:
textbutton i.caption action i.action
Code: Select all
vbox:
grid 2 2:
for i in items:
textbutton i.caption action i.action
Code: Select all
screen choice(items):
#style_prefix "choice"
# let's make a grid of 2 columns
$ rows, reminder = divmod(len(items), 2)
if reminder > 0:
$ rows += 1
grid 2 rows spacing 10:
align (0.5, 0.5)
xfill True
for ind, i in enumerate(items):
textbutton i.caption action i.action:
background Solid("#ccc")
xminimum config.screen_width/3
if ind%2 == 0:
xalign 0.1
text_xalign 0.1
else:
xalign 0.9
text_xalign 0.9
for n in range(2*rows-len(items)):
null
label start:
"..."
menu:
"Choice 1":
pass
"Choice 2":
pass
"Choice 3":
pass
"Choice 4":
pass
"Choice 5":
pass
"?!"I wanted to work on two boxs, as you said, the choice screen is a good idea. thanks anywayCrazy Li wrote: ↑Sat Jul 13, 2019 4:52 amHmm... I don't know for sure, but I assume you'll need to edit screens.rpy for this (or create your own screen for custom choice boxes and call that... but you said simple explanation and making your own custom screen isn't exactly simple :p )
My best guess is to search for the area that defines the Choice screen, approximately 200 lines in. If you were to change the existingintoCode: Select all
vbox: for i in items: textbutton i.caption action i.action
It would in theory make 2 columns of choices... HOWEVER this would only work if you always use exactly 4 choices... any more or any less and it would surely give an error, so I'm positive that this is not the correct solution.Code: Select all
vbox: grid 2 2: for i in items: textbutton i.caption action i.action
I'm not sure there's an actual "easy" way to do this. It probably takes a lot of fancy coding to determine how to lay it out based on the items pulled (so most likely the correct code actually goes after the "for i in items:" part)... but I'm not that good at Python to know what exactly you'd wanna do here. I'm sure someone will come along with the exact method that you can just copy and paste into your project though...
Thank you, this is great. I'm sure to use thisAlex wrote: ↑Sat Jul 13, 2019 8:35 pmAs Crazy Li said, you need to modify choice screen in screens.rpy. Try it likeCode: Select all
screen choice(items): #style_prefix "choice" # let's make a grid of 2 columns $ rows, reminder = divmod(len(items), 2) if reminder > 0: $ rows += 1 grid 2 rows spacing 10: align (0.5, 0.5) xfill True for ind, i in enumerate(items): textbutton i.caption action i.action: background Solid("#ccc") xminimum config.screen_width/3 if ind%2 == 0: xalign 0.1 text_xalign 0.1 else: xalign 0.9 text_xalign 0.9 for n in range(2*rows-len(items)): null label start: "..." menu: "Choice 1": pass "Choice 2": pass "Choice 3": pass "Choice 4": pass "Choice 5": pass "?!"
https://www.renpy.org/doc/html/screens.html#grid
https://www.renpy.org/doc/html/style_pr ... properties
https://www.renpy.org/doc/html/style_pr ... erty-xfill
https://www.renpy.org/doc/html/style_pr ... properties
https://www.renpy.org/doc/html/style_pr ... properties
Users browsing this forum: Bing [Bot], Majestic-12 [Bot]