项目配置

在DPG中,可以在创建项目时设置各种配置选项和标志。所有项目都有几个通用选项(即 show )但大多数物品都有特定的选项。

为了在创建后修改项的配置,您可以使用 configure_item 命令与项的关键字 *add_* ** *命令。方法以词典的形式检索项配置 get_item_configuration 指挥部。

示例

以下是简单的用法:

import dearpygui.dearpygui as dpg

dpg.create_context()

with dpg.window(width=500, height=300):
    dpg.add_button(enabled=True, label="Press me", tag="item")

    # at a later time, change the item's configuration
    dpg.configure_item("item", enabled=False, label="New Label")

dpg.create_viewport(title='Custom Title', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()