Skip to content

How to adjust the value of add_input_int dynamically ? #2052

Answered by phonm
phonm asked this question in Support
Discussion options

You must be logged in to vote

I have figurated out!
Use dpg.configure_item to control the default_value.
the example as follows:
import dearpygui.dearpygui as dpg

dpg.create_context()

status = True
def test():
global status
if status==True:
status = False
dpg.configure_item("item1", enabled=True, label="New Label")
dpg.configure_item("item2", enabled=True, default_value=1)

elif status==False:
status = True
dpg.configure_item("item1", enabled=True, label=" old Label")
dpg.configure_item("item2", enabled=True, default_value=5)

print(status)
with dpg.window(width=500, height=300):
dpg.add_button(enabled=True, label="Press me", tag="item1", callback=test)
dpg.add_input_int(label="test", tag='item2',min_value=0,default_val…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by phonm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
1 participant