I'd like to make a grid of drag and drop displayables of dynamically generated text, with background images.
The following doesn't work:
Code:
init python:
from string import ascii_letters
caps = ascii_letters[26:]
def puzzle_screen(grid_size=8, **kwargs):
ui.grid(grid_size, grid_size, id='puzzle_grid')
for i in caps[0:grid_size]:
for j in range(grid_size):
drag_id = i + str(j)
drag_child = ui.textbutton(drag_id, id='_' + drag_id, xminimum=50, yminimum=50, xpadding=0, background='rectangle.png')
ui.drag(d=drag_child, drag_name=drag_id, id=drag_id)
ui.close()
renpy.define_screen('puzzle_screen', puzzle_screen)
Code:
Exception: Widget <renpy.display.dragdrop.Drag object at 0x03441230> expects a child.
How should I pass a child to ui.drag()?
And, is there a better way to create a displayable of text with background then ui.textbutton()? Should I create a custom displayable?