0

Мне нужно, чтобы мои кнопки в дискорде были рядом друг с другом, а не так, чтобы одна была под другой. Как это сделать? Фрагмент кода:

await ctx.send(
        embed=discord.Embed(title='123',
                            description='456',
                            colour=discord.Color.green()),
        components=[
            Button(style=ButtonStyle.grey, label='text1'),
            Button(style=ButtonStyle.grey, label='text2')
        ]
    )

1 ответ 1

0

Чтобы кнопки находились на одной линии, поместите их во вложенный список.

Например:

await ctx.send(
    embed=discord.Embed(title='123',
                        description='456',
                        colour=discord.Color.green()),
    components=[
        #первая линия
        [Button(style=ButtonStyle.grey, label='к1 л1'),
         Button(style=ButtonStyle.grey, label='к2 л1')],
        #вторая линия
        [Button(style=ButtonStyle.grey, label='к1 л2'),
         Button(style=ButtonStyle.grey, label='к2 л2')]
    ]
)

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.