Python Forum
UnUnloading values from multiple widgets in a container
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UnUnloading values from multiple widgets in a container
#1
All,
I just started using ipywidgets and I am trying to find the ropes, so if this question has been answered previously or the documentation covers it in some way, kindly point me to that section. Essentially, here is a miniature version of the UI I am trying to develop. The question that has got me perplexed is, once I construct a UI like shown below, and the user provides their input, how do I unload the input ? I am hoping to collect values for each of the variables and trigger my logic, but the only thing I see in the documentation talks about using either interact or interactive. However I am not really sure how to use them with multiple widgets, all the examples I have come across seem to point to using them with a single widget. If anyone could point me to a good resource or provide a sample, that would be helpful.
With that classifier, here is what I am trying to do:

style = {'description_width': 'initial'}

def input_tab(tab_list, tab_names_list):
    if len(tab_list) == len(tab_names_list):
        this_tab = Tab()
        this_tab.children = tab_list
        [this_tab.set_title(i, title) for i, title in enumerate(tab_names_list)]
        return this_tab
    else:
        raise ValueError('\n Input lists should be of the same size')

def get_input_panel_num():
    input_1 = widgets.Text(value='3000', description='Input-1', style=style)
    input_2 = widgets.Dropdown(options=['yes', 'no'], description='Select one', value='yes', disabled=False, style=style)
    input_3 = widgets.IntSlider(value=0, min=0, max=1, step=1, description='Input-3', orientation='horizontal', readout=True, 
                               style=style)
    input_list_num = [input_1, input_2, input_3]
    return input_list_num

def get_input_panel_char():
    input_a = widgets.Text(value='3000', description='Input-1', style=style)
    input_b = widgets.Dropdown(options=['yes', 'no'], description='Select one', value='yes', disabled=False, style=style)
    input_c = widgets.IntSlider(value=0, min=0, max=1, step=1, description='Input-3', orientation='horizontal', readout=True, 
                               style=style)
    input_list_char = [input_a, input_b, input_c]
    return input_list_char

def create_master_tab():
    tab_names = ["tab-1", "tab-2"]
    panel_num = VBox(get_input_panel_num())
    panel_char = VBox(get_input_panel_char())
    final = input_tab(tab_list=[panel_num, panel_char], tab_names_list=tab_names)
    return final

demo = create_master_tab()
demo 
Reply


Messages In This Thread
UnUnloading values from multiple widgets in a container - by UGuntupalli - Apr-15-2020, 04:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  __init__() got multiple values for argument 'schema' dawid294 4 2,607 Jan-03-2024, 09:42 AM
Last Post: buran
  uploading files from a ubuntu local directory to Minio storage container dchilambo 0 508 Dec-22-2023, 07:17 AM
Last Post: dchilambo
  Upload Files to Azure Storage Container phillyfa 6 810 Dec-22-2023, 06:11 AM
Last Post: Pedroski55
Lightbulb shutdown host from docker container cosmin1805 0 976 Nov-27-2022, 06:34 PM
Last Post: cosmin1805
  networkx package is not visible in singularity container image erdemath 11 2,372 Oct-14-2022, 12:04 PM
Last Post: Larz60+
  python installation/running inside singularity container erdemath 2 1,860 Sep-21-2022, 08:13 AM
Last Post: erdemath
  Python in Singularity Container on Ubuntu erdemath 0 933 Aug-31-2022, 02:17 PM
Last Post: erdemath
  How to combine multiple column values into 1? cubangt 15 2,955 Aug-11-2022, 08:25 PM
Last Post: cubangt
  Function - Return multiple values tester_V 10 4,569 Jun-02-2021, 05:34 AM
Last Post: tester_V
  Xlsxwriter: Create Multiple Sheets Based on Dataframe's Sorted Values KMV 2 3,549 Mar-09-2021, 12:24 PM
Last Post: KMV

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020