Addition to callbacks & custom UIs - Python
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 45/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
从链接的 callbacks 和自定义 UIs 文档页面开始,并检查周围的示例。在现有的 global 和 nonlocal 指导旁边,加入所展示的基于 Python 模块、用于存储由 UI 控制的值的方法,并使用 variables.py 和 main.py 作为示例。完成的标准是页面清楚地解释这一替代方案,并且示例与 callback API 保持一致。
由索引模型根据 Issue 内容生成。
描述
https://polyscope.run/py/features/callbacks_and_UIs/#creating-custom-uis
#If we want to use local variables & assign to them in the UI code below,
# we need to mark them as nonlocal. This is because of how Python scoping
# rules work, not anything particular about Polyscope or ImGui.
# Of course, you can also use any other kind of python variable as a controllable
# value in the UI, such as a value from a dictionary, or a class member. Just be
# sure to assign the result of the ImGui call to the value, as in the examples below.
#
# If these variables are defined at the top level of a Python script file (i.e., not
# inside any method), you will need to use the `global` keyword instead of nonlocal`.
If you want to avoid using declarations global or nonlocal,
you can also use different module to store these values and call it on main module as below
variables.py
is_true: bool = False
main.py
import variables as vr
def callback()
change, vr.is_true = psim.Checkbox("Selection box", vr.is_true)
- 主要语言
- C++
- 星标
- 2.2k
- 派生
- 242
- 平均合并
- 11 分钟
- 30 天内合并 PR
- 1
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nmwsharp/polyscope 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 5/5 一周以上 新手友好度 30/100
-
Rust Version 未关闭
难度 5/5 一周以上 新手友好度 15/100
-
enhancement
难度 5/5 一周以上 新手友好度 20/100
查看 nmwsharp/polyscope 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
gazebosim/gz-sensors#662 · 1 条评论 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 76/100
-
comp-datalake
难度 2/5 1-3 小时 新手友好度 88/100
ClickHouse/ClickHouse#121222 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
LadybirdBrowser/ladybird#12123 ·