Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dearpygui/_dearpygui.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions dearpygui/dearpygui.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions dearpygui/demo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import dearpygui.dearpygui as dpg
import math
from math import sin, cos, log10
import random
import webbrowser
from math import cos, log10, sin

import dearpygui.dearpygui as dpg

count_2d_histogram = 50_000
xybin_2d_histogram = [100, 100]
Expand Down Expand Up @@ -300,6 +301,7 @@ def _log(sender, app_data, user_data):
dpg.add_button(label="Hold me button", callback=_log, repeat=True)

dpg.add_checkbox(label="checkbox", callback=_log)
dpg.add_mixed_state_checkbox(label="mixed state checkbox", callback=_log, default_value=-1)
dpg.add_radio_button(("radio a", "radio b", "radio c"), callback=_log, horizontal=True)
dpg.add_selectable(label="selectable", callback=_log)

Expand Down
43 changes: 41 additions & 2 deletions src/mvAppItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ CanItemTypeBeHovered(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -359,6 +360,7 @@ CanItemTypeBeActive(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -410,6 +412,7 @@ CanItemTypeBeFocused(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -462,6 +465,7 @@ CanItemTypeBeClicked(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragFloat:
Expand Down Expand Up @@ -516,6 +520,7 @@ CanItemTypeBeVisible(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -619,6 +624,7 @@ CanItemTypeBeActivated(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -669,6 +675,7 @@ CanItemTypeBeDeactivated(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -746,7 +753,8 @@ CanItemTypeBeDeactivatedAE(mvAppItemType type)
case mvAppItemType::mvColorMapSlider:
case mvAppItemType::mvColorPicker:
case mvAppItemType::mvGroup:
case mvAppItemType::mvCheckbox: return true;
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox: return true;
default: return false;
}

Expand All @@ -772,6 +780,7 @@ CanItemTypeHaveRectMin(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -835,6 +844,7 @@ CanItemTypeHaveRectSize(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -897,6 +907,7 @@ CanItemTypeHaveContAvail(mvAppItemType type)
switch (type)
{
case mvAppItemType::mvCheckbox:
case mvAppItemType::mvMixedStateCheckbox:
case mvAppItemType::mvCombo:
case mvAppItemType::mvDragInt:
case mvAppItemType::mvDragIntMulti:
Expand Down Expand Up @@ -1141,7 +1152,8 @@ DearPyGui::GetEntityValueType(mvAppItemType type)
case mvAppItemType::mvIntValue:
case mvAppItemType::mvSliderInt:
case mvAppItemType::mvInputInt:
case mvAppItemType::mvDragInt: return StorageValueTypes::Int;
case mvAppItemType::mvDragInt:
case mvAppItemType::mvMixedStateCheckbox: return StorageValueTypes::Int;

case mvAppItemType::mvFloatValue:
case mvAppItemType::mvProgressBar:
Expand Down Expand Up @@ -1510,6 +1522,7 @@ DearPyGui::GetAllowableParents(mvAppItemType type)
MV_START_PARENTS
MV_ADD_PARENT(mvAppItemType::mvButton),
MV_ADD_PARENT(mvAppItemType::mvCheckbox),
MV_ADD_PARENT(mvAppItemType::mvMixedStateCheckbox),
MV_ADD_PARENT(mvAppItemType::mvCombo),
MV_ADD_PARENT(mvAppItemType::mvDragIntMulti),
MV_ADD_PARENT(mvAppItemType::mvDragFloatMulti),
Expand Down Expand Up @@ -1908,6 +1921,32 @@ DearPyGui::GetEntityParser(mvAppItemType type)
break;
}

case mvAppItemType::mvMixedStateCheckbox:
{
AddCommonArgs(args, (CommonParserArgs)(
MV_PARSER_ARG_ID |
MV_PARSER_ARG_INDENT |
MV_PARSER_ARG_PARENT |
MV_PARSER_ARG_BEFORE |
MV_PARSER_ARG_SOURCE |
MV_PARSER_ARG_CALLBACK |
MV_PARSER_ARG_SHOW |
MV_PARSER_ARG_ENABLED |
MV_PARSER_ARG_FILTER |
MV_PARSER_ARG_DROP_CALLBACK |
MV_PARSER_ARG_DRAG_CALLBACK |
MV_PARSER_ARG_PAYLOAD_TYPE |
MV_PARSER_ARG_TRACKED |
MV_PARSER_ARG_POS)
);

args.push_back({ mvPyDataType::Integer, "default_value", mvArgType::KEYWORD_ARG, "0", "Sets the default value: -1 for mixed/indeterminate, 0 for unchecked, 1 for checked" });
args.push_back({ mvPyDataType::Integer, "mixed_click_value", mvArgType::KEYWORD_ARG, "1", "Sets the value when clicking the checkbox in mixed state: 0 for unchecked, 1 for checked" });

setup.about = "Adds a mixed state (tristate) checkbox. Value is -1 (mixed), 0 (unchecked), or 1 (checked).";
break;
}

case mvAppItemType::mvCombo:
{
AddCommonArgs(args, (CommonParserArgs)(
Expand Down
1 change: 1 addition & 0 deletions src/mvAppItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ GetEntityCommand(mvAppItemType type)

case mvAppItemType::mvButton: return "add_button";
case mvAppItemType::mvCheckbox: return "add_checkbox";
case mvAppItemType::mvMixedStateCheckbox: return "add_mixed_state_checkbox";
case mvAppItemType::mvInputText: return "add_input_text";
case mvAppItemType::mvRadioButton: return "add_radio_button";
case mvAppItemType::mvTabBar: return "add_tab_bar";
Expand Down
1 change: 1 addition & 0 deletions src/mvAppItemTypes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
X( mvCollapsingHeader ) \
X( mvSeparator ) \
X( mvCheckbox ) \
X( mvMixedStateCheckbox ) \
X( mvListbox ) \
X( mvText ) \
X( mvCombo ) \
Expand Down
Loading