Page 1 of 1

[CS:GO] Parent Menu

Posted: Sat Nov 10, 2018 5:24 pm
by velocity
How would I make a parent_menu if it takes an argument like index.

Code: Select all

def menu_1(index):
    player = player_instances[index]
    steamid = player.steamid
    menu = PagedMenu(
        title='Menu 1',
        select_callback=None
    )
    menu.append(PagedOption('Hello1', 'hello'))
    menu.send(index)


def menu_2(index):
    menu = PagedMenu(
        title='Menu 2',
        select_callback=None,
        parent_menu=menu_1
    )
    menu.append(PagedOption('Hello2', 'hello'))
    menu.send(index)


Re: [CS:GO] Parent Menu

Posted: Sun Nov 11, 2018 12:23 am
by khaimovmr
velocity wrote:How would I make a parent_menu if it takes an argument like index.

Don't you mean that you want a dynamically composed menu items in your parent menu?

Re: [CS:GO] Parent Menu

Posted: Sun Nov 11, 2018 3:44 pm
by Ayuto
I would simply use the build_callback instead of creating individual menus for every player. Then you have one menu instance for all players, but they will be rebuilt for every player before they are sent/refreshed.

Re: [CS:GO] Parent Menu

Posted: Tue Nov 13, 2018 2:08 pm
by velocity
Im not sure what you mean, I never messed around with build_callback. How would I proceed?

Re: [CS:GO] Parent Menu

Posted: Tue Nov 13, 2018 4:29 pm
by Ayuto