Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, you can achieve your goal with nested interacts. As a proof of concept, try the following code:

regions = {"Africa": ["Nigeria", "Tunisia", "Uganda", "South Africa" ],
           "America": ["Argentina", "Mexico", "Peru", "United States"],
           "Asia": ["China", "India", "Japan", "Thailand"],
           "Europe": ["France", "Germany", "Poland", "Spain"],
           "Oceania": ["Australia", "Fiji", "New Zealand", "Samoa"]}
@interact
def panel_1(region=selector(regions.keys(), label="Region")):
    @interact
    def panel_2(country=selector(regions[region], label="Country")):
        print(region, country)