本文整理匯總了Python中ipywidgets.Tab方法的典型用法代碼示例。如果您正苦於以下問題:Python ipywidgets.Tab方法的具體用法?Python ipywidgets.Tab怎麽用?Python ipywidgets.Tab使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ipywidgets
的用法示例。
在下文中一共展示了ipywidgets.Tab方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: make_sub_tab_widget
# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Tab [as 別名]
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
示例2: __init__
# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Tab [as 別名]
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])
示例3: create_widgets
# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Tab [as 別名]
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()
示例4: __init__
# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Tab [as 別名]
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])
示例5: __init__
# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Tab [as 別名]
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])
示例6: __init__
# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Tab [as 別名]
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])
示例7: build_dashboard_widget
# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Tab [as 別名]
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
示例8: __init__
# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Tab [as 別名]
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