Select
# Select
在地图上添加选择控件。
函数 | 返回值 |
---|---|
Select() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
sl = ui.Select()
sl.setOptions([1, 2, 3, 4, 5])
ui_control = WidgetControl(widget = sl)
m.add_control(ui_control)
m
# setOptions
设置可选数据。
函数 | 返回值 |
---|---|
setOptions(options) | Widget |
参数 | 类型 | 说明 |
---|---|---|
options | List | 数据列表 |
# 示例
sl = ui.Select()
sl.setOptions([1, 2, 3, 4, 5])
# getOptions
返回可选的数据。
函数 | 返回值 |
---|---|
getOptions() | Widget |
# 示例
sl = ui.Select()
sl.setOptions([1, 2, 3, 4, 5])
print(sl.getOptions())
# setValue
设置默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Str|Int | 设置默认值 |
# 示例
sl = ui.Select()
sl.setOptions([1, 2, 3, 4, 5])
sl.setValue(1)
# setDescription
设置控件的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | Str | 显示的名称 |
# 示例
sl = ui.Select()
sl.setDescription('Select')
# getDescription
返回名称。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
sl = ui.Select()
sl.setDescription('Select')
print(sl.getDescription())
# setDisabled
设置控件是否可用。
函数 | 返回值 |
---|---|
setDisabled() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
sl = ui.Select()
sl.setDisabled(False)
# Text
在地图上添加文本框控件。
函数 | 返回值 |
---|---|
Text() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.Text()
text.setDescription("text")
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# setValue
设置文本框默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Str|Int | 显示的默认值 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.Text()
text.setDescription("text")
text.setValue('textbox')
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# getValue
返回文本框的默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.Text()
text.setDescription("text")
text.setValue('textbox')
print(text.getValue())
# setDescription
设置文本框的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 显示的名称 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.Text()
text.setDescription("text")
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# getDescription
返回文本框的名称。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.Text()
text.setDescription("text")
print(text.getDescription())
# setDisabled
设置文本框是否可用。
函数 | 返回值 |
---|---|
setDisabled(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.Text()
text.setDescription("text")
text.setDisabled(True)
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# TextArea
在地图上添加文本框控件。
函数 | 返回值 |
---|---|
TextArea() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.TextArea()
text.setDescription("text")
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# setValue
设置文本框默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Str|Int | 显示的默认值 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.TextArea()
text.setDescription("text")
text.setValue('textbox')
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# getValue
返回文本框的默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.TextArea()
text.setDescription("text")
text.setValue('textbox')
print(text.getValue())
# setDescription
设置文本框的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 显示的名称 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.TextArea()
text.setDescription("text")
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# getDescription
返回文本框的名称。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.TextArea()
text.setDescription("text")
print(text.getDescription())
# setDisabled
设置文本框是否可用。
函数 | 返回值 |
---|---|
setDisabled(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.TextArea()
text.setDescription("text")
text.setDisabled(True)
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# setPlaceholder
当value为空时的占位符。
函数 | 返回值 |
---|---|
setPlaceholder(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String|Int | 显示的默认值 |
# 示例
text = ui.TextArea()
text.setPlaceholder("100")
# getPlaceholder
返回占位符。
函数 | 返回值 |
---|---|
getPlaceholder() | Widget |
# 示例
text = ui.TextArea()
text.setPlaceholder("100")
print(text.getPlaceholder())
# ToggleButton
在地图上添加切换控件。
函数 | 返回值 |
---|---|
ToggleButton() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
tb = ui.ToggleButton()
ui_control = WidgetControl(widget = tb)
m.add_control(ui_control)
m
# setValue
设置控件选中与否的状态。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
tb = ui.ToggleButton()
tb.setValue(False)
# setDescription
设置控件的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 显示的名称 |
# 示例
tb = ui.ToggleButton()
tb.setDescription('ToggleButton')
# getDescription
返回控件的名称。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
tb = ui.ToggleButton()
tb.setDescription('ToggleButton')
print(tb.getDescription())
# setDisabled
设置是否可点击。
函数 | 返回值 |
---|---|
setDisabled() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
tb = ui.ToggleButton()
tb.setDisabled(False)
# setButtonStyle
设置控件的信息状态。
函数 | 返回值 |
---|---|
setButtonStyle(style) | Widget |
参数 | 类型 | 说明 |
---|---|---|
style | String | 包括“success, info, warning, danger” |
# 示例
tb = ui.ToggleButton()
tb.setButtonStyle("success")
# setIcon
设置按钮的图标。
函数 | 返回值 |
---|---|
setIcon(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Str | 'check' |
# 示例
tb = ui.ToggleButton()
tb.setIcon('check')
# Vbox
在地图上添加垂直箱控件。
函数 | 返回值 |
---|---|
Vbox() | Widget |
# 示例
import pie
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
from ipywidgets.widgets import Layout
m = pie.Map()
vb = ui.Vbox()
vb.setBoxStyle("success")
ui_control = WidgetControl(widget = vb)
m.add_control(ui_control)
m
# setBoxStyle
设置控件的状态。
函数 | 返回值 |
---|---|
setBoxStyle(style) | Widget |
参数 | 类型 | 说明 |
---|---|---|
style | String | 控件的状态,包括“success, info, warning, danger” |
# 示例
vb = ui.Vbox()
vb.setBoxStyle("success")
# getBoxStyle
返回控件的状态。
函数 | 返回值 |
---|---|
getBoxStyle() | Widget |
# 示例
vb = ui.Vbox()
vb.setBoxStyle("success")
print(vb.getBoxStyle())
# setLayout
设置控件的布局。
函数 | 返回值 |
---|---|
setLayout(layout) | Widget |
参数 | 类型 | 说明 |
---|---|---|
layout | String |
# 示例
from ipywidgets.widgets import Layout
vb = ui.Vbox()
vb.setLayout(Layout(height="100px", width="100px"))
# getLayout
返回布局。
函数 | 返回值 |
---|---|
getLayout() | Widget |
# 示例
from ipywidgets.widgets import Layout
vb = ui.Vbox()
vb.setLayout(Layout(height="100px", width="100px"))
print(vb.getLayout())
# setChildren
设置控件包含的子控件。
函数 | 返回值 |
---|---|
setChildren(children) | Widget |
参数 | 类型 | 说明 |
---|---|---|
children | List | 子控件 |
# 示例
vb = ui.Vbox()
text = ui.Text()
text.setValue('text')
vb.setChildren([text])
# getChildren
返回子控件。
函数 | 返回值 |
---|---|
getChildren() | Widget |
# 示例
vb = ui.Vbox()
text = ui.Text()
text.setValue('text')
vb.setChildren([text])
print(vb.getChildren())
有问题,我来改改 (opens new window)
上次更新: 2022/05/25, 07:37:39