init python:
    class dice_game_class:
        def __init__(self):
            self.num = 3
            self.dices = []
            self.keeps = []
            self.imgs = [0,"⚀","⚁","⚂","⚃","⚄","⚅"]
            self.throw()
        def keep(self, x):
            self.keeps.append(x)
            self.dices.remove(x)
        
        def disc(self, x):
            self.keeps.remove(x)

        def throw(self):
            self.dices = []
            for i in range(self.num):
                self.dices.append(renpy.random.randint(1, 6))
            renpy.restart_interaction()

init python:
    try:
        scr_run_lst.append(["dices", ToggleScreen('dices')])
    except:
        pass
define dice_game_ins = dice_game_class()
screen dices(d = dice_game_ins):
    modal True
    
    hbox:

        frame:
            xysize 500,500
            vbox:
                box_wrap True spacing 0
                for i in d.keeps:
                    button:
                        at btn
                        xysize 100,100
                        text "{}".format(d.imgs[i]) size 70
                        action Function(d.disc, i), Function(d.throw)

        frame:
            xysize 200,500
            vbox:
                for i in d.dices:
                    button:
                        at btn
                        xysize 100,100
                        text "{}".format(d.imgs[i]) size 70
                        action If(len(d.keeps) < 16, Function(d.keep, i))



