{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# `QKnob`\n", "\n", "这个元素是基于Quasar框架中的[`QKnob`组件](https://quasar.dev/vue-components/knob)。该元素用于通过鼠标/触摸平移从用户那里获取数字输入。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- `value`: 初始值(默认:`0.0`)\n", "- `min`: 最小值(默认:`0.0`)\n", "- `max`: 最大值(默认:`1.0`)\n", "- `step`: 步长(默认:`0.01`)\n", "- `color`: 旋钮颜色(可以是Quasar、Tailwind或CSS颜色,或者 `None`,默认:`\"primary\"`)\n", "- `center_color`: 组件中心部分的颜色名称,示例:`primary`, `teal-10`\n", "- `track_color`: 组件轨道的颜色名称,示例:`primary`, `teal-10`\n", "- `size`: CSS单位大小,包括单位名称或标准大小名称(`xs|sm|md|lg|xl`),示例:`16px, 2rem`\n", "- `show_value`: 是否以文本形式显示值\n", "- `on_change`: 值改变时执行的回调函数" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from nicegui import ui\n", "\n", "knob = ui.knob(0.3, show_value=True)\n", "\n", "with ui.knob(color='orange', track_color='grey-2').bind_value(knob, 'value'):\n", " ui.icon('volume_up')\n", "\n", "# ui.run()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "py311", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" } }, "nbformat": 4, "nbformat_minor": 2 }