- target_output
- widget_value
Most of the time, the value sitting in a node's widget is invisible to the rest of your graph. 小珠光获取控件值 (Xiaozhuguang Get Widget) changes that: you connect it to any output of a target node, and it reads that node's widget values and hands them to you as a string. Want the filename of the image a loader is pointing at, the seed a sampler is about to use, the resolution of an empty latent - without converting any of those widgets to inputs? This is the node.
It's a genuinely clever piece of plumbing, the kind that only works because ComfyUI's graph is inspectable at runtime. The use cases are the boring-but-real ones: baking a filename or seed into a text output for display, logging what a workflow actually ran, or feeding a widget value into a node that can't accept that type as a wire. It turns your workflow into something that can report on itself.
How it works
Under the hood it uses ComfyUI's dynamic prompt machinery (DYNPROMPT) to look up the target node you've connected and read its declared inputs - the widget values as they'll be passed. Leave widget_name empty and it dumps every widget as name: value lines; name one and it outputs just that value. show_widget_prefix toggles the name: label, and show_extension strips file extensions from filenames (.png, .mp4, etc.) if you only want the stem. It always re-runs (IS_CHANGED returns NaN) so it never serves a stale value, and it raises a clear error if you forgot to connect it.
The inputs that matter
target_output- the connection. Plug any output of the node you want to inspect. This is the only thing the node absolutely needs.widget_name- leave empty for everything, or name one widget.show_widget_prefix-widget: valuevs barevalue.show_extension- keep or strip file extensions.
Output: widget_value (STRING).
Install
From the ComfyUI-xiaozhuguang pack - Manager (search "ComfyUI-xiaozhuguang"), or:
cd ComfyUI/custom_nodes/
git clone https://github.com/xiaozhuguang/ComfyUI-xiaozhuguang.git
Restart. No dependencies beyond core.
Gotchas
The connection is everything: target_output must actually be wired, or you get an error telling you to connect it. And because it inspects the graph at run time, it sees widget values - if a widget has been converted to an input and is fed by another node, the read reflects what arrived, not the widget's typed default, which is usually exactly what you want. The always-rerun behavior means it's a terminal-friendly node: put it at the end of a debug chain, not in the middle of a hot path.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| target_outputopt | * | — | |
| widget_nameopt | STRING | Leave empty to output all widget values; specify widget_name to output the corresponding value | |
| show_widget_prefixopt | BOOLEAN | true | Enable to output 'widget_name: value' format, disable to output only the value |
| show_extensionopt | BOOLEAN | true | Enable to show file extension (e.g., .PNG, .jpg, etc.), disable to remove the extension |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| widget_value | STRING | — |