-
I have add_input_int, default value is 0 initial and after other function works, x is changed to 1, and how to adjust the "show" value of add_input_int to 1 at the same time? Dose use the parameter "user_data" or "source", or callback? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have figurated out! dpg.create_context() status = True elif status==False: print(status) at a later time, change the item's configurationdpg.configure_item("item", enabled=False, label="New Label")dpg.create_viewport(title='Custom Title', width=800, height=600) |
Beta Was this translation helpful? Give feedback.
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…