DearPyGUI provides a functional interface for creating objects - windows, groups, et al. This library provides a collection of classes that can be used to create DPG objects as instances.
pip install dpgcontainersfrom dpgcontainers.containers import Window, Group, Button
window = Window(width=100, height=200)(
Group(horizontal=True)(
Button(tag='button_1'),
Button(tag='button_2'),
),
)
window.tagged_entities['button_1'].callback = lambda: print('clicked!')
window.render()Children are captured by calling instances as functions. The render cycle is aware of objects that have already been rendered, so the following is fine:
window = Window()
window(Button('button_1'))
window.render()
window(Button('button_2'))
window.render()- added
findmethod to base class, returns first found named child search_named_childrendeprecated, use newly addedfindinstead.- added
find_all, returns a list of all named children matching name - added
searchandsearch_allmethods, which function on named children but allow regex pattern searching - Themes, Colormaps, and Fonts can now be bound via
instance.bind()orinstance.bind(item)as appropriate