I want to set the font of the title of a window as font1 and any other items as font2.
I know I can achieve this as follow:
import dearpygui.dearpygui as dpg
dpg.create_context()
with dpg.font_registry():
with dpg.font(...) as font1:
...
with dpg.font(...) as font2:
...
dpg.bind_font(font1)
...
with dpg.window(...) as window1:
item1 = dpg.draw_line(...)
item2 = dpg.add_text(...)
item3 = dpg.add_button(...)
...
# set the font of all the items one by one
dpg.bind_item_font(item1, font2)
dpg.bind_item_font(item2, font2)
dpg.bind_item_font(item3, font2)
...
# OR something a little bit smarter
items = dpg.get_item_children(window1)
for id in items[1]:
dpg.bind_item_font(id, font2)
for id in items[2]:
dpg.bind_item_font(id, font2)
...
But such codes seems really stupid. Is there any function in dpg that can get a tag referring to the "item" of the title of the window? so that I can use code like this:
import dearpygui.dearpygui as dpg
dpg.create_context()
with dpg.font_registry():
with dpg.font(...) as font1:
...
with dpg.font(...) as font2:
...
dpg.bind_font(font2)
...
with dpg.window(...) as window1:
title_id = ... # get the tag of the window title "item"
dpg.bind_item_font(title_id, font1)
# or something like dpg.set_title_font(font1)
item1 = dpg.draw_line(...)
item2 = dpg.add_text(...)
item3 = dpg.add_button(...)
...
# the font of the rest of items are set to font2 by default
...