Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

imgui_knobs

ImGui Knobs: rotary knobs for numeric values, in several styles (tick, dot, wiper, stepped, space...).

knob(label, value, v_min, v_max) returns (changed, new_value); knob_int() is its integer version.

The module imgui_bundle.imgui_knobs, the Python API of ImGui Knobs, from bindings/imgui_bundle/imgui_knobs.pyi: 4 functions, 2 classes, 2 enums. Each entry gives the Python signature, then the C++ one, then the doc of the C++ header. The sections are the header’s.

imgui-knobs.h

ImGuiKnobFlags_ (enum)

MemberValueC++
no_title1 << 0ImGuiKnobFlags_NoTitle = 1 << 0
no_input1 << 1ImGuiKnobFlags_NoInput = 1 << 1
value_tooltip1 << 2ImGuiKnobFlags_ValueTooltip = 1 << 2
drag_horizontal1 << 3ImGuiKnobFlags_DragHorizontal = 1 << 3
drag_vertical1 << 4ImGuiKnobFlags_DragVertical = 1 << 4
logarithmic1 << 5ImGuiKnobFlags_Logarithmic = 1 << 5
always_clamp1 << 6ImGuiKnobFlags_AlwaysClamp = 1 << 6

ImGuiKnobVariant_ (enum)

MemberValueC++
tick1 << 0ImGuiKnobVariant_Tick = 1 << 0
dot1 << 1ImGuiKnobVariant_Dot = 1 << 1
wiper1 << 2ImGuiKnobVariant_Wiper = 1 << 2
wiper_only1 << 3ImGuiKnobVariant_WiperOnly = 1 << 3
wiper_dot1 << 4ImGuiKnobVariant_WiperDot = 1 << 4
stepped1 << 5ImGuiKnobVariant_Stepped = 1 << 5
space1 << 6ImGuiKnobVariant_Space = 1 << 6, }

color_set (class)

AttributeC++
base: ImColorImColor base;
hovered: ImColorImColor hovered;
active: ImColorImColor active;

color_set.__init__

@overload
def __init__(self, base: ImColor, hovered: ImColor, active: ImColor) -> None

@overload
def __init__(self) -> None

@overload
def __init__(self, color: ImColor) -> None
color_set(ImColor base, ImColor hovered, ImColor active)
color_set() : base(ImColor(0, 0, 0)), hovered(ImColor(0, 0, 0)), active(ImColor(0, 0, 0));
color_set(ImColor color);
            : base(base), hovered(hovered), active(active);

KnobColors (class)

AttributeC++
primary: color_setcolor_set primary;
secondary: color_setcolor_set secondary;
track: color_setcolor_set track;

KnobColors.__init__

def __init__(self, primary: Optional[color_set] = None, secondary: Optional[color_set] = None, track: Optional[color_set] = None) -> None

Auto-generated default constructor with named params

Python bindings defaults:
If any of the params below is None, then its default value below will be used: * primary: color_set() * secondary: color_set() * track: color_set()

set_knob_colors

def set_knob_colors(colors: KnobColors) -> None
void SetKnobColors(const KnobColors& colors);

Set custom knob colors. Pass individual color_sets for primary (indicator), secondary (circle body), and track (background arc).

unset_knob_colors

def unset_knob_colors() -> None
void UnsetKnobColors();

Reset to theme-aware defaults (auto-detects dark/light theme).

knob

def knob(label: str, p_value: float, v_min: float, v_max: float, speed: float = 0, format: str = '%.3f', variant: Optional[ImGuiKnobVariant] = None, size: float = 0, flags: ImGuiKnobFlags = 0, steps: int = 10, angle_min: float = -1, angle_max: float = -1) -> Tuple[bool, float]
bool Knob( const char *label, float *p_value, float v_min, float v_max, float speed = 0, const char *format = "%.3f", ImGuiKnobVariant variant = ImGuiKnobVariant_Tick, float size = 0, ImGuiKnobFlags flags = 0, int steps = 10, float angle_min = -1, float angle_max = -1);

Python bindings defaults:
If variant is None, then its default value will be: ImGuiKnobVariant_.tick

knob_int

def knob_int(label: str, p_value: int, v_min: int, v_max: int, speed: float = 0, format: str = '%i', variant: Optional[ImGuiKnobVariant] = None, size: float = 0, flags: ImGuiKnobFlags = 0, steps: int = 10, angle_min: float = -1, angle_max: float = -1) -> Tuple[bool, int]
bool KnobInt( const char *label, int *p_value, int v_min, int v_max, float speed = 0, const char *format = "%i", ImGuiKnobVariant variant = ImGuiKnobVariant_Tick, float size = 0, ImGuiKnobFlags flags = 0, int steps = 10, float angle_min = -1, float angle_max = -1);

Python bindings defaults:
If variant is None, then its default value will be: ImGuiKnobVariant_.tick