Python ipywidgets.Tab() Examples

The following are 8 code examples of ipywidgets.Tab(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module ipywidgets , or try the search function .
Example #1
Source File: ABuWGStockInfo.py    From abu with GNU General Public License v3.0 6 votes vote down vote up
def make_sub_tab_widget(self, stock_info, sub_dict):
        """用于构建:股本/港股股本/机构持股子tab,市盈率/市净率/市销率子tab, 总市值/每股净资产/流通股本子tab"""
        sub_widget_array = []
        sub_widget_table_name = []
        for sc in sub_dict:
            if sc in stock_info.columns:
                sub_name = to_unicode(sub_dict[sc])
                sub_widget = widgets.Text(
                    value=to_unicode(stock_info[sc].values[0]),
                    description=sub_name,
                    disabled=False
                )
                sub_widget_array.append(sub_widget)
                sub_widget_table_name.append(sub_name)

        sub_widget_tab = widgets.Tab()
        sub_widget_tab.children = sub_widget_array
        for ind, name in enumerate(sub_widget_table_name):
            sub_widget_tab.set_title(ind, name)
        return sub_widget_tab 
Example #2
Source File: gui.py    From pyiron with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def create_widgets(self):
        """

        Returns:

        """
        select = widgets.Select  # Multiple
        self.w_group = select(description="Groups:")
        self.w_node = select(description="Nodes:")
        self.w_file = select(description="Files:")
        self.w_text = widgets.HTML()
        # self.w_text = widgets.Textarea()
        self.w_text.layout.height = "330px"
        self.w_text.layout.width = "580px"
        self.w_text.disabled = True
        #         self.w_plot = self.fig
        w_list = widgets.VBox([self.w_group, self.w_node, self.w_file])
        self.w_tab = widgets.HBox([w_list, self.w_text])
        #         tab = widgets.Tab(children=[self.w_group, self.w_node, self.w_file, self.w_text])
        #         [tab.set_title(num, name) for num, name in enumerate(['groups', 'nodes', 'files', 'text'])]
        #         self.w_tab = tab

        self.w_path = widgets.Text(name="Path: ")
        self.w_path.layout.width = "680px"
        self.w_type = widgets.Text(name="Type: ")

        self.refresh_view() 
Example #3
Source File: ABuWGBRun.py    From abu with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        """构建回测需要的各个组件形成tab"""
        self.tt = WidgetRunTT()
        self.sc = WidgetSymbolChoice()
        self.bf = BuyFactorWGManager()

        self.sf = SellFactorWGManager()
        # 卖出策略管理注册买入策略接收改变
        self.sf.register(self.bf)

        self.ps = PickStockWGManager()
        # 选股策略管理注册买入策略接收改变
        self.ps.register(self.bf)

        self.pos = PosWGManager()
        # 资金管理注册买入策略接收改变
        self.pos.register(self.bf)

        # 构造裁判界面
        self.ump = WidgetUmp()

        sub_widget_tab = widgets.Tab()
        sub_widget_tab.children = [self.tt.widget, self.sc.widget, self.bf.widget, self.sf.widget, self.ps.widget,
                                   self.pos.widget, self.ump.widget]
        for ind, name in enumerate([u'基本', u'股池', u'买策', u'卖策', u'选股', u'资管', u'裁判']):
            sub_widget_tab.set_title(ind, name)

        self.run_loop_bt = widgets.Button(description=u'开始回测', layout=widgets.Layout(width='98%'),
                                          button_style='danger')
        self.run_loop_bt.on_click(self.run_loop_back)
        self.widget = widgets.VBox([sub_widget_tab, self.run_loop_bt]) 
Example #4
Source File: ABuWGUmp.py    From abu with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        """构建回测需要的各个组件形成tab"""
        sub_widget_tab = widgets.Tab()
        # 裁判特征采集界面初始化
        feature_tab = self._init_feature_ui()
        # 裁判特征训练界面初始化
        train_tab = self._init_train_ui()
        # 裁判预测拦截界面初始化
        predict_tab = self._init_predict_ui()
        # 裁判数据管理界面初始化
        manager_tab = self._init_manager_ui()

        sub_widget_tab.children = [feature_tab, train_tab, predict_tab, manager_tab]
        for ind, name in enumerate([u'裁判特征采集', u'裁判特征训练', u'裁判预测拦截', u'裁判数据管理']):
            sub_widget_tab.set_title(ind, name)
        self.widget = widgets.VBox([sub_widget_tab]) 
Example #5
Source File: ABuWGQuantTool.py    From abu with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self.ts = WidgetToolSet()
        self.da = WidgetDATool(self.ts)
        self.tl = WidgetTLTool(self.ts)
        self.sm = WidgetSMTool(self.ts)
        sub_widget_tab = widgets.Tab()
        sub_widget_tab.children = [self.tl.widget, self.sm.widget, self.da.widget, self.ts.widget]
        for ind, name in enumerate([u'技术分析', u'相关分析', u'振幅分析', u'分析设置']):
            sub_widget_tab.set_title(ind, name)
        self.widget = widgets.VBox([sub_widget_tab]) 
Example #6
Source File: ABuWGGridSearch.py    From abu with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        """构建回测需要的各个组件形成tab"""

        tip_label1 = widgets.Label(u'最优参数grid search暂不支持实时网络数据模式', layout=widgets.Layout(width='300px'))
        tip_label2 = widgets.Label(u'非沙盒模式需先用\'数据下载界面操作\'进行下载', layout=widgets.Layout(width='300px'))
        """沙盒数据与开放数据模式切换"""
        self.date_mode = widgets.RadioButtons(
            options=[u'沙盒数据模式', u'开放数据模式'],
            value=u'沙盒数据模式' if ABuEnv._g_enable_example_env_ipython else u'开放数据模式',
            description=u'数据模式:',
            disabled=False
        )
        self.date_mode.observe(self.on_data_mode_change, names='value')
        date_mode_box = widgets.VBox([tip_label1, tip_label2, self.date_mode])

        self.sc = WidgetSymbolChoice()
        self.bf = BuyFactorWGManager(add_button_style='grid')
        self.sf = SellFactorWGManager(show_add_buy=False, add_button_style='grid')

        sub_widget_tab = widgets.Tab()
        sub_widget_tab.children = [self.bf.widget, self.sf.widget, self.sc.widget]
        for ind, name in enumerate([u'买策', u'卖策', u'股池']):
            sub_widget_tab.set_title(ind, name)

        self.begin_grid_search = widgets.Button(description=u'开始寻找策略最优参数组合', layout=widgets.Layout(width='98%'),
                                                button_style='danger')
        self.begin_grid_search.on_click(self.run_grid_search)

        self.widget = widgets.VBox([date_mode_box, sub_widget_tab, self.begin_grid_search]) 
Example #7
Source File: dashboard.py    From qiskit-ibmq-provider with Apache License 2.0 4 votes vote down vote up
def build_dashboard_widget() -> AccordionWithThread:
    """Build the dashboard widget.

    Returns:
        Dashboard widget.
    """
    tabs = wid.Tab(layout=wid.Layout(width='760px',
                                     max_height='650px')
                   )

    devices = wid.VBox(children=[],
                       layout=wid.Layout(width='740px',
                                         height='100%')
                       )

    device_list = wid.Box(children=[devices], layout=wid.Layout(width='auto',
                                                                max_height='600px'
                                                                ))

    jobs_box = wid.VBox(layout=wid.Layout(max_width='740px',
                                          min_width='740px',
                                          justify_content='flex-start'))
    tabs.children = [device_list, jobs_box]
    tabs.set_title(0, 'Devices')
    tabs.set_title(1, 'Jobs')

    acc = AccordionWithThread(children=[tabs],
                              layout=wid.Layout(width='auto',
                                                max_height='700px',
                                                ))

    acc._device_list = acc.children[0].children[0].children[0]

    acc.set_title(0, 'IQX Dashboard')
    acc.selected_index = None
    acc.layout.visibility = 'hidden'
    display(acc)
    acc._dom_classes = ['job_widget']
    display(Javascript("""$('div.job_widget')
        .detach()
        .appendTo($('#header'))
        .css({
            'z-index': 999,
             'position': 'fixed',
            'box-shadow': '5px 5px 5px -3px black',
            'opacity': 0.95,
            'float': 'left,'
        })
        """))
    acc.layout.visibility = 'visible'
    return acc 
Example #8
Source File: ABuWGCrossVal.py    From abu with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self):
        """构建回测需要的各个组件形成tab"""

        tip_label1 = widgets.Label(u'策略相关性交叉验证暂不支持实时网络数据模式', layout=widgets.Layout(width='300px'))
        tip_label2 = widgets.Label(u'需先用\'数据下载界面操作\'进行下载', layout=widgets.Layout(width='300px'))

        self.bf = BuyFactorWGManager()
        self.sf = SellFactorWGManager(show_add_buy=True)

        sub_widget_tab = widgets.Tab()
        sub_widget_tab.children = [self.bf.widget, self.sf.widget]
        for ind, name in enumerate([u'买策', u'卖策']):
            sub_widget_tab.set_title(ind, name)

        self.begin_cross_val = widgets.Button(description=u'开始交叉相关性验证策略有效性',
                                              layout=widgets.Layout(width='98%'),
                                              button_style='danger')
        self.begin_cross_val.on_click(self.run_cross_val)

        self.market = widgets.Dropdown(
            options={u'美股': EMarketTargetType.E_MARKET_TARGET_US.value,
                     u'A股': EMarketTargetType.E_MARKET_TARGET_CN.value,
                     u'港股': EMarketTargetType.E_MARKET_TARGET_HK.value,
                     u'国内期货': EMarketTargetType.E_MARKET_TARGET_FUTURES_CN.value,
                     u'国际期货': EMarketTargetType.E_MARKET_TARGET_FUTURES_GLOBAL.value,
                     u'数字货币': EMarketTargetType.E_MARKET_TARGET_TC.value},
            value=ABuEnv.g_market_target.value,
            description=u'验证市场:',
        )

        cv_label1 = widgets.Label(u'交叉验证的数量级:默认10', layout=widgets.Layout(width='300px'))
        cv_label2 = widgets.Label(u'cv次相关度范围随机抽取cv个symbol进行回测', layout=widgets.Layout(width='300px'))
        self.cv = widgets.IntSlider(
            value=10,
            min=4,
            max=50,
            step=1,
            description=u'cv',
            disabled=False,
            orientation='horizontal',
            readout=True,
            readout_format='d'
        )
        cv_box = widgets.VBox([cv_label1, cv_label2, self.cv])

        self.widget = widgets.VBox([tip_label1, tip_label2, sub_widget_tab, self.market, cv_box,
                                    self.begin_cross_val])

        # 初始化就new处理,每次运行都使用它,可以缓存similar数据
        self.cross_val = AbuCrossVal()

    # noinspection PyUnusedLocal