ui
# 简介
平台提供丰富的交互式UI组件,UI组件的出现为专业用户提供了一个可以直接使用、分享以及探讨遥感技术的方式,为广大非专业的用户降低了应用遥感数据和算法的门槛。
UI组件包括文本、表格、单选框、输入框、颜色选择器、日期选择器、数字输入框、复选框、开关按钮、滑动条、下拉列表、按钮等。
# Box
在地图上添加箱控件。
函数 | 返回值 |
---|---|
Box() | Widget |
# 示例
import pie
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
box= ui.Box()
box.setBoxStyle("success")
box_control = WidgetControl(widget = box)
m.add_control(box_control)
m
# setBoxStyle
设置box的状态。
函数 | 返回值 |
---|---|
setBoxStyle(style) | Widget |
参数 | 类型 | 说明 |
---|---|---|
style | String | 设置box的状态,包括“success, info, warning, danger” |
# 示例
import pie
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
box= ui.Box()
box.setBoxStyle("success")
box_control = WidgetControl(widget = box)
m.add_control(box_control)
m
# getBoxStyle
返回box的状态。
函数 | 返回值 |
---|---|
getBoxStyle() | Widget |
# 示例
box= ui.Box()
box.setBoxStyle("success")
print(box.getBoxStyle())
# setChildren
设置box内放置的其他控件。
函数 | 返回值 |
---|---|
setChildren(children) | Widget |
参数 | 类型 | 说明 |
---|---|---|
children | widget | 设置box内放置的其他控件 |
# 示例
m = pie.Map()
button=ui.Button()
button.setButtonStyle('info')
box= ui.Box()
box.setBoxStyle("success")
box.setChildren([button])
box_control = WidgetControl(widget = box)
m.add_control(box_control)
m
# getChildren
返回box的子控件。
函数 | 返回值 |
---|---|
getChildren() | Widget |
# 示例
button=ui.Button()
button.setButtonStyle('info')
box= ui.Box()
box.setBoxStyle("success")
box.setChildren([button])
print(box.getChildren())
# Button
在地图上添加按钮。
函数 | 返回值 |
---|---|
Button() | Widget |
# 示例
import pie
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
button = ui.Button()
button_control = WidgetControl(widget = button)
m.add_control(button_control)
m
# setDescription
设置描述信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 按钮的描述 |
# 示例
import pie
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
button = ui.Button()
button.setDescription('ok')
button_control = WidgetControl(widget = button)
m.add_control(button_control)
m
# getDescription
返回描述信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
import pie.ui as ui
import pie
m = pie.Map()
button = ui.Button()
button.setDescription('ok')
des = button.getDescription()
print(des)
# setDisabled
设置是否可点击。
函数 | 返回值 |
---|---|
setDisabled() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
import pie.ui as ui
import pie
m = pie.Map()
button = ui.Button()
button.setDisabled(False)
button_control = WidgetControl(widget = button)
m.add_control(button_control)
m
# setButtonStyle
设置按钮的样式。
函数 | 返回值 |
---|---|
setButtonStyle(style) | Widget |
参数 | 类型 | 说明 |
---|---|---|
style | String | 设置box的状态,包括“success, info, warning, danger” |
# 示例
import pie
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
button = ui.Button()
button.setButtonStyle(style="success")
button_control = WidgetControl(widget = button)
m.add_control(button_control)
m
# getButtonStyle
返回按钮的样式。
函数 | 返回值 |
---|---|
getButtonStyle() | Widget |
# 示例
import pie.ui as ui
import pie
m = pie.Map()
button = ui.Button()
button.setButtonStyle(style="success")
print(button.getButtonStyle())
# setToolTip
设置按钮的提示。
函数 | 返回值 |
---|---|
setToolTip(content) | Widget |
参数 | 类型 | 说明 |
---|---|---|
content | String | 按钮的提示 |
# 示例
import pie
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
button = ui.Button()
button.setToolTip(content='tooltip')
button_control = WidgetControl(widget = button)
m.add_control(button_control)
m
# getToolTip
返回按钮的提示。
函数 | 返回值 |
---|---|
getToolTip() | Widget |
# 示例
button = ui.Button()
button.setToolTip(content='tooltip')
print(button.getToolTip())
# setIcon
设置按钮的图标。
函数 | 返回值 |
---|---|
setIcon(icon) | Widget |
参数 | 类型 | 说明 |
---|---|---|
icon | String | 按钮的图标 |
# 示例
m = pie.Map()
button = ui.Button()
button.setIcon(icon='anchor')
button_control = WidgetControl(widget = button)
m.add_control(button_control)
m
# getIcon
返回按钮的图标。
函数 | 返回值 |
---|---|
getIcon() | Widget |
# 示例
button = ui.Button()
button.setIcon(icon='apple-alt')
print(button.getIcon())
# onClick
点击按钮触发的函数。
函数 | 返回值 |
---|---|
onClick(callback) | Widget |
参数 | 类型 | 说明 |
---|---|---|
callback | function | 点击按钮触发的函数 |
# 示例
m = pie.Map()
def output(c):
print('one click')
button = ui.Button()
button.onClick(callback=output)
button_control = WidgetControl(widget = button)
m.add_control(button_control)
m
# Checkbox
在地图上添加复选框。
函数 | 返回值 |
---|---|
Checkbox() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
cb = ui.Checkbox()
cb.setValue(True)
cb.setDescription("checkbox")
ui_control = WidgetControl(widget = cb)
m.add_control(ui_control)
m
# setValue
设置复选框是否选中。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
cb = ui.Checkbox()
cb.setValue(True)
cb.setDescription("checkbox")
ui_control = WidgetControl(widget = cb)
m.add_control(ui_control)
m
# getValue
返回选中的状态值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
cb = ui.Checkbox()
cb.setValue(True)
print(cb.getValue())
# setDescription
设置复选框的信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 复选框的信息 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
cb = ui.Checkbox()
cb.setValue(True)
cb.setDescription("checkbox")
ui_control = WidgetControl(widget = cb)
m.add_control(ui_control)
m
# getDescription
返回复选框的信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
cb = ui.Checkbox()
cb.setValue(True)
cb.setDescription("checkbox")
print(cb.getDescription())
# setDisabled
设置复选框是否可用。
函数 | 返回值 |
---|---|
setDisabled() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
cb = ui.Checkbox()
cb.setDisabled(False)
# setIndent
设置复选框是否缩进。
函数 | 返回值 |
---|---|
setIndent() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
cb = ui.Checkbox()
cb.setValue(True)
cb.setIndent(True)
cb.setDescription("checkbox")
ui_control = WidgetControl(widget = cb)
m.add_control(ui_control)
m
# ColorPicker
在地图上添加颜色选择控件。
函数 | 返回值 |
---|---|
ColorPicker() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
cp = ui.ColorPicker()
ui_control = WidgetControl(widget = cp)
m.add_control(ui_control)
m
# setConcise
设置简化版颜色选择控件。
函数 | 返回值 |
---|---|
setConcise(concise) | Widget |
参数 | 类型 | 说明 |
---|---|---|
concise | Bool | True or False |
# 示例
cp = ui.ColorPicker()
cp.setConcise(True)
# getConcise
返回是否是简化版控件的状态。
函数 | 返回值 |
---|---|
getConcise() | Widget |
# 示例
cp = ui.ColorPicker()
cp.setConcise(True)
print(cp.getConcise())
# setValue
设置控件的默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String | 颜色名称 |
# 示例
cp = ui.ColorPicker()
cp.setValue("red")
# getValue
返回控件的默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
cp = ui.ColorPicker()
cp.setValue("red")
print(cp.getValue())
# setDescription
设置控件的信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 控件的信息 |
# 示例
cp = ui.ColorPicker()
cp.setDescription("color picker")
# getDescription
返回控件的信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
cp = ui.ColorPicker()
cp.setDescription("color picker")
print(cp.getDescription())
# setDisabled
设置控件是否可用。
函数 | 返回值 |
---|---|
setDisabled() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
cp = ui.ColorPicker()
cp.setDisabled(False)
# Combobox
在地图上添加组合框。
函数 | 返回值 |
---|---|
Combobox() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
cb = ui.Combobox()
ui_control = WidgetControl(widget = cb)
m.add_control(ui_control)
m
# setValue
设置组合框的默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String|Int | 显示的默认值 |
# 示例
cb = ui.Combobox()
cb.setValue("0")
# getValue
返回默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
cb = ui.Combobox()
cb.setValue("0")
print(cb.getValue())
# setPlaceholder
当value为空时的占位符。
函数 | 返回值 |
---|---|
setPlaceholder(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String|Int | 显示的默认值 |
# 示例
cb = ui.Combobox()
cb.setPlaceholder("100")
# getPlaceholder
返回占位符。
函数 | 返回值 |
---|---|
getPlaceholder() | Widget |
# 示例
cb = ui.Combobox()
cb.setPlaceholder("100")
print(cb.getPlaceholder())
# setOptions
设置可选值。
函数 | 返回值 |
---|---|
setOptions(options) | Widget |
参数 | 类型 | 说明 |
---|---|---|
options | List | 可选择的值 |
# 示例
cb = ui.Combobox()
cb.setOptions(['1', '2', '3', '4', '5'])
# getOptions
返回设置的可选值。
函数 | 返回值 |
---|---|
getOptions() | Widget |
# 示例
cb = ui.Combobox()
cb.setOptions(['1', '2', '3', '4', '5'])
print(cb.getOptions())
# setDescription
设置组合框的信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 组合框的信息 |
# 示例
cb = ui.Combobox()
cb.setDescription('combobox')
# getDescription
返回组合框的信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
cb = ui.Combobox()
cb.setDescription('combobox')
print(cb.getDescription())
# setDisabled
设置组合框是否可用。
函数 | 返回值 |
---|---|
setDisabled(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
cb = ui.Combobox()
cb.setDisabled(True)
# DatePicker
在地图上添加日期选择控件。
函数 | 返回值 |
---|---|
DatePicker() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
dp = ui.DatePicker()
ui_control = WidgetControl(widget = dp)
m.add_control(ui_control)
m
# setValue
设置日期。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String | 日期 |
# 示例
import datetime
date = datetime.date(2019, 7, 9)
dp = ui.DatePicker()
dp.setValue(date)
# getValue
返回日期。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
date = datetime.date(2019, 7, 9)
dp = ui.DatePicker()
dp.setValue(date)
print(dp.getValue())
# setDescription
设置控件的信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 控件的信息 |
# 示例
dp = ui.DatePicker()
dp.setDescription('date picker')
# getDescription
返回控件的信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
dp = ui.DatePicker()
dp.setDescription('date picker')
print(dp.getDescription())
# DropDown
在地图上添加下拉框控件。
函数 | 返回值 |
---|---|
DropDown() | Widget |
# 示例
import pie
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
dd = ui.DropDown()
ui_control = WidgetControl(widget = dd)
m.add_control(ui_control)
m
# setValue
设置默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String|Int|Floate | 默认值 |
# 示例
dd = ui.DropDown()
dd.setOptions(['1','2','3'])
dd.setValue('1')
# getValue
返回默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
dd = ui.DropDown()
dd.setOptions(['1','2','3'])
dd.setValue('1')
print(dd.getValue())
# setOptions
设置元素列表。
函数 | 返回值 |
---|---|
setOptions(options) | Widget |
参数 | 类型 | 说明 |
---|---|---|
options | List | 可选择的值 |
# 示例
dd = ui.DropDown()
dd.setOptions(['1','2','3'])
# getOptions
返回元素列表。
函数 | 返回值 |
---|---|
getOptions() | Widget |
# 示例
dd = ui.DropDown()
dd.setOptions(['1','2','3'])
print(dd.getOptions())
# setDescription
设置控件的信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 描述信息 |
# 示例
dd = ui.DropDown()
dd.setDescription('drop down')
# getDescription
返回描述信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
dd = ui.DropDown()
dd.setDescription('drop down')
print(dd.getDescription())
# setDisabled
设置控件是否可用。
函数 | 返回值 |
---|---|
setDisabled(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
dd = ui.DropDown()
dd.setDisabled(False)
# FloatProgress
在地图上添加进度条控件。
函数 | 返回值 |
---|---|
FloatProgress() | Widget |
# 示例
import pie
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
fp = ui.FloatProgress()
ui_control = WidgetControl(widget = fp)
m.add_control(ui_control)
m
# setValue
设置默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 默认值 |
# 示例
fp = ui.FloatProgress()
fp.setValue(10)
# setMin
设置最小值。
函数 | 返回值 |
---|---|
setMin(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int|Float | 最小值 |
# 示例
fp = ui.FloatProgress()
fp.setMin(1)
# setMax
设置最大值。
函数 | 返回值 |
---|---|
setMax(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int|Float | 最大值 |
# 示例
fp = ui.FloatProgress()
fp.setMax(1000)
# setDescription
设置控件的描述信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 描述信息 |
# 示例
fp = ui.FloatProgress()
fp.setDescription('float progress')
# setBarStyle
设置控件的状态。
函数 | 返回值 |
---|---|
ssetBarStyle(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String | 控件的状态,"success, info, warning, danger" |
# 示例
fp = ui.FloatProgress()
fp.setBarStyle("success")
# setStyle
设置控件的样式。
函数 | 返回值 |
---|---|
setStyle(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Dict | 样式 |
# 示例
fp = ui.FloatProgress()
fp.setStyle({'bar_color': '#ffff00'})
# setOrientation
设置控件的方向。
函数 | 返回值 |
---|---|
setOrientation(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Str | 方向“vertical, horizontal” |
# 示例
fp = ui.FloatProgress()
fp.setOrientation("vertical")
# FloatSlider
在地图上添加浮点数值滑动条。
函数 | 返回值 |
---|---|
FloatSlider() | Widget |
# 示例
import pie
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
fs = ui.FloatSlider()
ui_control = WidgetControl(widget = fs)
m.add_control(ui_control)
m
# setValue
设置默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int|Float | 默认值 |
# 示例
fs = ui.FloatSlider()
fs.setValue(10.0)
# getValue
返回默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
fs = ui.FloatSlider()
fs.setValue(10.0)
print(fs.getValue())
# setMin
设置控件的最小值。
函数 | 返回值 |
---|---|
setMin() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int|Float | 最小值 |
# 示例
fs = ui.FloatSlider()
fs.setMin(1.1)
# setMax
设置控件的最大值。
函数 | 返回值 |
---|---|
setMax() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int|Float | 最大值 |
# 示例
fs = ui.FloatSlider()
fs.setMax(50.0)
# setStep
设置步长。
函数 | 返回值 |
---|---|
setStep(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int|Float | 步长 |
# 示例
fs = ui.FloatSlider()
fs.setStep(5)
# getStep
返回步长。
函数 | 返回值 |
---|---|
getStep() | Widget |
# 示例
fs = ui.FloatSlider()
fs.setStep(5)
print(fs.getStep())
# setDescription
设置描述信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 描述信息 |
# 示例
fs = ui.FloatSlider()
fs.setDescription('Float Slider')
# getDescription
返回描述信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
fs = ui.FloatSlider()
fs.setDescription('Float Slider')
print(fs.getDescription())
# FloatText
地图上添加文本框控件。
函数 | 返回值 |
---|---|
FloatText() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.FloatText()
text.setDescription("text")
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# setValue
设置文本框默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String|Int | 显示的默认值 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
text = ui.FloatText()
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.FloatText()
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.FloatText()
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.FloatText()
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.FloatText()
text.setDescription("text")
text.setDisabled(True)
ui_control = WidgetControl(widget = text)
m.add_control(ui_control)
m
# GridBox
在地图上添加网格箱控件。
函数 | 返回值 |
---|---|
GridBox() | Widget |
# 示例
import pie
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
gb = ui.GridBox()
gb.setBoxStyle("success")
ui_control = WidgetControl(widget = gb)
m.add_control(ui_control)
m
# setBoxStyle
设置控件的状态。
函数 | 返回值 |
---|---|
setBoxStyle(style) | Widget |
参数 | 类型 | 说明 |
---|---|---|
style | String | 控件的状态,包括“success, info, warning, danger” |
# 示例
gb = ui.GridBox()
gb.setBoxStyle("success")
# getBoxStyle
返回控件的状态。
函数 | 返回值 |
---|---|
getBoxStyle() | Widget |
# 示例
gb = ui.GridBox()
gb.setBoxStyle("success")
print(gb.getBoxStyle())
# setChildren
设置控件包含的子控件。
函数 | 返回值 |
---|---|
setChildren(children) | Widget |
参数 | 类型 | 说明 |
---|---|---|
children | List | 子控件 |
# 示例
gb = ui.GridBox()
text = ui.Text()
text.setValue('text')
gb.setChildren([text])
# getChildren
返回子控件。
函数 | 返回值 |
---|---|
getChildren() | Widget |
# 示例
gb = ui.GridBox()
text = ui.Text()
text.setValue('text')
gb.setChildren([text])
print(gb.getChildren())
# Hbox
在地图上添加水平箱控件。
函数 | 返回值 |
---|---|
Hbox() | Widget |
# 示例
import pie
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
hb = ui.Hbox()
hb.setBoxStyle("success")
ui_control = WidgetControl(widget = hb)
m.add_control(ui_control)
m
# setBoxStyle
设置控件的状态。
函数 | 返回值 |
---|---|
setBoxStyle(style) | Widget |
参数 | 类型 | 说明 |
---|---|---|
style | String | 控件的状态,包括“success, info, warning, danger” |
# 示例
hb = ui.Hbox()
hb.setBoxStyle("success")
# getBoxStyle
返回控件的状态。
函数 | 返回值 |
---|---|
getBoxStyle() | Widget |
# 示例
hb = ui.Hbox()
hb.setBoxStyle("success")
print(hb.getBoxStyle())
# setLayout
设置控件的布局。
函数 | 返回值 |
---|---|
setLayout(layout) | Widget |
参数 | 类型 | 说明 |
---|---|---|
layout | String |
# 示例
from ipywidgets.widgets import Layout
hb = ui.Hbox()
hb.setLayout(Layout(height="100px", width="100px"))
# getLayout
返回布局。
函数 | 返回值 |
---|---|
getLayout() | Widget |
# 示例
from ipywidgets.widgets import Layout
hb = ui.Hbox()
hb.setLayout(Layout(height="100px", width="100px"))
print(hb.getLayout())
# setChildren
设置控件包含的子控件。
函数 | 返回值 |
---|---|
setChildren(children) | Widget |
参数 | 类型 | 说明 |
---|---|---|
children | List | 子控件 |
# 示例
hb = ui.Hbox()
text = ui.Text()
text.setValue(“text”)
hb.setChildren([text])
# getChildren
返回子控件。
函数 | 返回值 |
---|---|
getChildren() | Widget |
# 示例
hb = ui.Hbox()
text = ui.Text()
text.setValue(“text”)
hb.setChildren([text])
print(hb.getChildren())
# HTML
在地图上添加HTML控件。
函数 | 返回值 |
---|---|
HTML() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
ht = ui.HTML()
ht.setValue("html")
ui_control = WidgetControl(widget = ht)
m.add_control(ui_control)
m
# setValue
设置文本框默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String | 显示的默认值 |
# 示例
ht = ui.HTML()
ht.setValue("html")
# getValue
返回文本框的默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
ht = ui.HTML()
ht.setValue("html")
print(ht.getValue())
# setDescription
设置文本框的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 显示的名称 |
# 示例
ht = ui.HTML()
ht.setDescription('HTML')
# getDescription
返回文本框的名称。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
ht = ui.HTML()
ht.setDescription('HTML')
print(ht.getDescription())
# IntProgress
在地图上添加进度条控件。
函数 | 返回值 |
---|---|
IntProgress() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
ip = ui.IntProgress()
ip.setValue(30)
ui_control = WidgetControl(widget = ip)
m.add_control(ui_control)
m
# setValue
设置默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 默认值 |
# 示例
ip = ui.IntProgress()
ip.setValue(30)
# setMin
设置最小值。
函数 | 返回值 |
---|---|
setMin(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 最小值 |
# 示例
ip = ui.IntProgress()
ip.setMin(10)
# setMax
设置最大值。
函数 | 返回值 |
---|---|
setMax(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 最大值 |
# 示例
ip = ui.IntProgress()
ip.setMax(1000)
# setDescription
设置控件的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 显示的名称 |
# 示例
ip = ui.IntProgress()
ip.setDescription('IntProgress')
# getDescription
返回控件的名称。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
ip = ui.IntProgress()
ip.setDescription('IntProgress')
print(ip.getDescription())
# setBarStyle
设置控件的状态。
函数 | 返回值 |
---|---|
ssetBarStyle(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String | 控件的状态,"success, info, warning, danger" |
# 示例
ip = ui.IntProgress()
ip.setBarStyle('info')
# setStyle
设置进度条样式。
函数 | 返回值 |
---|---|
setStyle(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Dict | 进度条样式,{'bar_color': 'maroon'} |
# 示例
ip = ui.IntProgress()
ip.setStyle({'bar_color': 'maroon'})
# setOrientation
设置进度条的方向。
函数 | 返回值 |
---|---|
setOrientation(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Str | 方向“vertical, horizontal” |
# 示例
ip = ui.IntProgress()
ip.setOrientation('horizontal')
# IntRangeSlider
在地图上添加滑动条控件。
函数 | 返回值 |
---|---|
IntRangeSlider() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
irs = ui.IntRangeSlider()
ui_control = WidgetControl(widget = irs)
m.add_control(ui_control)
m
# setValue
设置默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 默认值 |
# 示例
irs = ui.IntRangeSlider()
irs.setValue((1, 10))
# getValue
返回默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
irs = ui.IntRangeSlider()
irs.setValue((1, 10))
print(irs.getValue())
# setMin
设置控件的最小值。
函数 | 返回值 |
---|---|
setMin() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 最小值 |
# 示例
irs = ui.IntRangeSlider()
irs.setMin(1)
# getMin
返回最小值。
函数 | 返回值 |
---|---|
getMin() | Widget |
# 示例
irs = ui.IntRangeSlider()
irs.setMin(1)
print(irs.getMin())
# setMax
设置控件的最大值。
函数 | 返回值 |
---|---|
setMax() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 最大值 |
# 示例
irs = ui.IntRangeSlider()
irs.setMax(500)
# getMax
返回最大值。
函数 | 返回值 |
---|---|
getMax() | Widget |
# 示例
irs = ui.IntRangeSlider()
irs.setMax(50.0)
print(irs.getMax())
# setStep
设置步长。
函数 | 返回值 |
---|---|
setStep(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int|Float | 步长 |
# 示例
irs = ui.IntRangeSlider()
irs.setStep(5)
# getStep
返回步长。
函数 | 返回值 |
---|---|
getStep() | Widget |
# 示例
irs = ui.IntRangeSlider()
irs.setStep(5)
print(irs.getStep())
# setDescription
设置描述信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | Str | 描述信息 |
# 示例
irs = ui.IntRangeSlider()
irs.setDescription('IntRangeSlider')
# getDescription
返回描述信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
irs = ui.IntRangeSlider()
irs.setDescription('IntRangeSlider')
print(irs.getDescription())
# setDisabled
设置进度条是否可用。
函数 | 返回值 |
---|---|
setDisabled(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
irs = ui.IntRangeSlider()
irs.setDisabled(False)
# setOrientation
设置控件的方向。
函数 | 返回值 |
---|---|
setOrientation(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Str | 方向“vertical, horizontal” |
# 示例
irs = ui.IntRangeSlider()
irs.setOrientation('vertical')
# IntSlider
在地图上添加滑动条控件。
函数 | 返回值 |
---|---|
IntSlider() | Widget |
# 示例
import pie
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
isl = ui.IntSlider()
ui_control = WidgetControl(widget = isl)
m.add_control(ui_control)
m
# setValue
设置默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 默认值 |
# 示例
isl = ui.IntSlider()
isl.setValue(10)
# getValue
返回默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
isl = ui.IntSlider()
isl.setValue(10)
print(isl.getValue())
# setMin
设置控件的最小值。
函数 | 返回值 |
---|---|
setMin() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 最小值 |
# 示例
isl = ui.IntSlider()
isl.setMin(1)
# getMin
返回最小值。
函数 | 返回值 |
---|---|
getMin() | Widget |
# 示例
isl = ui.IntSlider()
isl.setMin(1)
print(isl.getMin())
# setMax
设置控件的最大值。
函数 | 返回值 |
---|---|
setMax() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 最大值 |
# 示例
isl = ui.IntSlider()
isl.setMax(5000)
# getMax
返回最大值。
函数 | 返回值 |
---|---|
getMax() | Widget |
# 示例
isl = ui.IntSlider()
isl.setMax(5000)
print(isl.getMax())
# setStep
设置步长。
函数 | 返回值 |
---|---|
setStep(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 步长 |
# 示例
isl = ui.IntSlider()
isl.setStep(5)
# getStep
返回步长。
函数 | 返回值 |
---|---|
getStep() | Widget |
# 示例
isl = ui.IntSlider()
isl.setStep(5)
print(isl.getStep())
# setDescription
设置描述信息。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 描述信息 |
# 示例
isl = ui.IntSlider()
isl.setDescription('IntSlider')
# getDescription
返回描述信息。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
isl = ui.IntSlider()
isl.setDescription('IntSlider')
print(isl.getDescription())
# IntText
地图上添加文本框控件。
函数 | 返回值 |
---|---|
IntText() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
it = ui.IntText()
it.setDescription("IntText")
ui_control = WidgetControl(widget = it)
m.add_control(ui_control)
m
# setValue
设置文本框默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String|Int | 显示的默认值 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
it= ui.IntText()
it.setDescription("IntText")
it.setValue(10)
ui_control = WidgetControl(widget = it)
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()
it = ui.IntText()
it.setDescription("IntText")
it.setValue(10)
print(it.getValue())
# setDescription
设置文本框的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 显示的名称 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
it= ui.IntText()
it.setDescription("IntText")
ui_control = WidgetControl(widget = it)
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()
it = ui.IntText()
it.setDescription("IntText")
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()
it = ui.IntText()
it.setDescription("IntText")
it.setDisabled(False)
ui_control = WidgetControl(widget = it)
m.add_control(ui_control)
m
# Label
在地图上添加标签控件。
函数 | 返回值 |
---|---|
Label() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
label = ui.Label()
label.setValue("a new label:")
ui_control = WidgetControl(widget = label)
m.add_control(ui_control)
m
# setValue
设置标签的名称。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | String | 标签的名称 |
# getValue
返回文本框的默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
label = ui.Label()
label.setValue("a new label:")
print(label.getValue())
# Layout
在地图上添加布局设置控件。
函数 | 返回值 |
---|---|
Layout() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
lo = ui.Layout()
lo.setPadding("20px 20px")
vb = ui.Vbox()
vb.setLayout(lo)
ui_control = WidgetControl(widget = vb)
m.add_control(ui_control)
m
# setPadding
设置控件大小。
函数 | 返回值 |
---|---|
setPadding(padding) | Widget |
参数 | 类型 | 说明 |
---|---|---|
padding | String | 控件大小的像素值 |
# 示例
lo = ui.Layout()
lo.setPadding("20px 20px")
# Link
在地图上添加联动控件。
函数 | 返回值 |
---|---|
Link(source,target) | Widget |
参数 | 类型 | 说明 |
---|---|---|
source | Tuple | 第一个控件 |
target | Tuple | 第二个控件 |
# 示例
import pie
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
box = ui.Box()
cb = ui.Combobox()
cb.setOptions(['1', '2', '3'])
text = ui.Text()
text.setValue('1')
box.children = [cb, text]
ui.Link((cb, "value"), (text, "value"))
ui_control = WidgetControl(widget = box)
m.add_control(ui_control)
m
# unlink
取消联动。
函数 | 返回值 |
---|---|
unlink() | Widget |
# 示例
ulink = ui.Link((cb, "value"), (text, "value"))
ulink.unlink()
# Play
在地图上添加播放控件。
函数 | 返回值 |
---|---|
Play() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
play = ui.Play()
ui_control = WidgetControl(widget = play)
m.add_control(ui_control)
m
# setValue
设置文本框默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 显示的默认值 |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
play = ui.Play()
play.setValue(10)
slider = ui.IntSlider()
ui.Link((play, "value"), (slider, "value"))
hbox = ui.Hbox()
hbox.setChildren([play, slider])
ui_control = WidgetControl(widget = hbox)
m.add_control(ui_control)
m
# getValue
返回文本框的默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
play = ui.Play()
play.setValue(10)
print(play.getValue())
# setMin
设置最小值。
函数 | 返回值 |
---|---|
setMin(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 最小值 |
# 示例
play = ui.Play()
play.setMin(1)
# getMin
返回最小值。
函数 | 返回值 |
---|---|
getMin() | Widget |
# 示例
play = ui.Play()
play.setMin(1)
print(play.getMin())
# setMax
设置最大值。
函数 | 返回值 |
---|---|
setMax(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 最大值 |
# 示例
play = ui.Play()
play.setMax(1000)
# getMax
返回最大值。
函数 | 返回值 |
---|---|
getMax() | Widget |
# 示例
play = ui.Play()
play.setMax(1000)
print(play.getMax())
# setStep
设置步长。
函数 | 返回值 |
---|---|
setStep(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Int | 步长 |
# 示例
play = ui.Play()
play.setStep(3)
# setDescription
设置控件的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | String | 显示的名称 |
# 示例
play = ui.Play()
play.setDescription('Play')
# getDescription
返回控件的名称。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
play = ui.Play()
play.setDescription('Play')
print(play.getDescription())
# setDisabled
设置控件是否可用。
函数 | 返回值 |
---|---|
setDisabled(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
play = ui.Play()
play.setDisabled(False)
# RadioButtons
在地图上添加选择控件。
函数 | 返回值 |
---|---|
RadioButtons() | Widget |
# 示例
from pie import Map
import pie.ui as ui
from ipyleaflet import WidgetControl
m = pie.Map()
rb = ui.RadioButtons()
ui_control = WidgetControl(widget = rb)
m.add_control(ui_control)
m
# setOptions
设置可选数据。
函数 | 返回值 |
---|---|
setOptions(options) | Widget |
参数 | 类型 | 说明 |
---|---|---|
options | List | 可选择的数据 |
# 示例
rb = ui.RadioButtons()
rb.setOptions([1, 2, 3])
# getOptions
返回可选的数据。
函数 | 返回值 |
---|---|
getOptions() | Widget |
# 示例
rb = ui.RadioButtons()
rb.setOptions([1, 2, 3])
print(rb.getOptions())
# setValue
设置默认值。
函数 | 返回值 |
---|---|
setValue(value) | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Str|Int | 默认显示的值,与options内容对应 |
# 示例
rb = ui.RadioButtons()
rb.setOptions([1, 2, 3])
rb.setValue(1)
# getValue
返回默认值。
函数 | 返回值 |
---|---|
getValue() | Widget |
# 示例
rb = ui.RadioButtons()
rb.setOptions([1, 2, 3])
rb.setValue(1)
print(rb.getValue())
# setDescription
设置控件的名称。
函数 | 返回值 |
---|---|
setDescription(description) | Widget |
参数 | 类型 | 说明 |
---|---|---|
description | Str | 显示的名称 |
# 示例
rb = ui.RadioButtons()
rb.setDescription('RadioButtons')
# getDescription
返回名称。
函数 | 返回值 |
---|---|
getDescription() | Widget |
# 示例
rb = ui.RadioButtons()
rb.setDescription('RadioButtons')
print(rb.getDescription())
# setDisabled
设置控件是否可用。
函数 | 返回值 |
---|---|
setDisabled() | Widget |
参数 | 类型 | 说明 |
---|---|---|
value | Bool | True or False |
# 示例
rb= ui.RadioButtons()
rb.setDisabled(False)