-
-
Notifications
You must be signed in to change notification settings - Fork 671
/
demo.py
2850 lines (2268 loc) · 171 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import dearpygui.dearpygui as dpg
import math
from math import sin, cos
import random
import webbrowser
def _help(message):
last_item = dpg.last_item()
group = dpg.add_group(horizontal=True)
dpg.move_item(last_item, parent=group)
dpg.capture_next_item(lambda s: dpg.move_item(s, parent=group))
t = dpg.add_text("(?)", color=[0, 255, 0])
with dpg.tooltip(t):
dpg.add_text(message)
def _hyperlink(text, address):
b = dpg.add_button(label=text, callback=lambda:webbrowser.open(address))
dpg.bind_item_theme(b, "__demo_hyperlinkTheme")
def _config(sender, keyword, user_data):
widget_type = dpg.get_item_type(sender)
items = user_data
if widget_type == "mvAppItemType::mvRadioButton":
value = True
else:
keyword = dpg.get_item_label(sender)
value = dpg.get_value(sender)
if isinstance(user_data, list):
for item in items:
dpg.configure_item(item, **{keyword: value})
else:
dpg.configure_item(items, **{keyword: value})
def _add_config_options(item, columns, *names, **kwargs):
if columns == 1:
if 'before' in kwargs:
for name in names:
dpg.add_checkbox(label=name, callback=_config, user_data=item, before=kwargs['before'], default_value=dpg.get_item_configuration(item)[name])
else:
for name in names:
dpg.add_checkbox(label=name, callback=_config, user_data=item, default_value=dpg.get_item_configuration(item)[name])
else:
if 'before' in kwargs:
dpg.push_container_stack(dpg.add_table(header_row=False, before=kwargs['before']))
else:
dpg.push_container_stack(dpg.add_table(header_row=False))
for i in range(columns):
dpg.add_table_column()
for i in range((len(names)+(columns - 1))//columns):
with dpg.table_row():
for j in range(columns):
if (i*columns + j) >= len(names):
break
dpg.add_checkbox(label=names[i*columns + j],
callback=_config, user_data=item,
default_value=dpg.get_item_configuration(item)[names[i*columns + j]])
dpg.pop_container_stack()
def _add_config_option(item, default_value, *names):
dpg.add_radio_button(names, default_value=default_value, callback=_config, user_data=item)
def _hsv_to_rgb(h, s, v):
if s == 0.0: return (v, v, v)
i = int(h*6.) # XXX assume int() truncates!
f = (h*6.)-i; p,q,t = v*(1.-s), v*(1.-s*f), v*(1.-s*(1.-f)); i%=6
if i == 0: return (255*v, 255*t, 255*p)
if i == 1: return (255*q, 255*v, 255*p)
if i == 2: return (255*p, 255*v, 255*t)
if i == 3: return (255*p, 255*q, 255*v)
if i == 4: return (255*t, 255*p, 255*v)
if i == 5: return (255*v, 255*p, 255*q)
def _create_static_textures():
## create static textures
texture_data1 = []
for i in range(100*100):
texture_data1.append(255/255)
texture_data1.append(0)
texture_data1.append(255/255)
texture_data1.append(255/255)
texture_data2 = []
for i in range(50*50):
texture_data2.append(255/255)
texture_data2.append(255/255)
texture_data2.append(0)
texture_data2.append(255/255)
texture_data3 = []
for row in range(50):
for column in range(50):
texture_data3.append(255/255)
texture_data3.append(0)
texture_data3.append(0)
texture_data3.append(255/255)
for column in range(50):
texture_data3.append(0)
texture_data3.append(255/255)
texture_data3.append(0)
texture_data3.append(255/255)
for row in range(50):
for column in range(50):
texture_data3.append(0)
texture_data3.append(0)
texture_data3.append(255/255)
texture_data3.append(255/255)
for column in range(50):
texture_data3.append(255/255)
texture_data3.append(255/255)
texture_data3.append(0)
texture_data3.append(255/255)
dpg.add_static_texture(100, 100, texture_data1, parent="__demo_texture_container", tag="__demo_static_texture_1", label="Static Texture 1")
dpg.add_static_texture(50, 50, texture_data2, parent="__demo_texture_container", tag="__demo_static_texture_2", label="Static Texture 2")
dpg.add_static_texture(100, 100, texture_data3, parent="__demo_texture_container", tag="__demo_static_texture_3", label="Static Texture 3")
def _create_dynamic_textures():
## create dynamic textures
texture_data1 = []
for i in range(100*100):
texture_data1.append(255/255)
texture_data1.append(0)
texture_data1.append(255/255)
texture_data1.append(255/255)
texture_data2 = []
for i in range(50*50):
texture_data2.append(255/255)
texture_data2.append(255/255)
texture_data2.append(0)
texture_data2.append(255/255)
dpg.add_dynamic_texture(100, 100, texture_data1, parent="__demo_texture_container", tag="__demo_dynamic_texture_1")
dpg.add_dynamic_texture(50, 50, texture_data2, parent="__demo_texture_container", tag="__demo_dynamic_texture_2")
def _update_dynamic_textures(sender, app_data, user_data):
new_color = app_data
new_color[0] = new_color[0]
new_color[1] = new_color[1]
new_color[2] = new_color[2]
new_color[3] = new_color[3]
if user_data == 1:
texture_data = []
for i in range(100*100):
texture_data.append(new_color[0])
texture_data.append(new_color[1])
texture_data.append(new_color[2])
texture_data.append(new_color[3])
dpg.set_value("__demo_dynamic_texture_1", texture_data)
elif user_data == 2:
texture_data = []
for i in range(50*50):
texture_data.append(new_color[0])
texture_data.append(new_color[1])
texture_data.append(new_color[2])
texture_data.append(new_color[3])
dpg.set_value("__demo_dynamic_texture_2", texture_data)
def _on_demo_close(sender, app_data, user_data):
dpg.delete_item(sender)
dpg.delete_item("__demo_texture_container")
dpg.delete_item("__demo_colormap_registry")
dpg.delete_item("__demo_hyperlinkTheme")
dpg.delete_item("__demo_theme_progressbar")
dpg.delete_item("stock_theme1")
dpg.delete_item("stock_theme2")
dpg.delete_item("stock_theme3")
dpg.delete_item("stock_theme4")
dpg.delete_item("stem_theme1")
dpg.delete_item("__demo_keyboard_handler")
dpg.delete_item("__demo_mouse_handler")
dpg.delete_item("__demo_filedialog")
dpg.delete_item("__demo_stage1")
dpg.delete_item("__demo_popup1")
dpg.delete_item("__demo_popup2")
dpg.delete_item("__demo_popup3")
dpg.delete_item("__demo_item_reg3")
dpg.delete_item("__demo_item_reg6")
dpg.delete_item("__demo_item_reg7")
dpg.delete_item("demoitemregistry")
for i in range(7):
dpg.delete_item("__demo_theme"+str(i))
dpg.delete_item("__demo_theme2_"+str(i))
for i in range(5):
dpg.delete_item("__demo_item_reg1_"+str(i))
dpg.delete_item("__demo_item_reg2_"+str(i))
for i in range(3):
dpg.delete_item("__demo_item_reg4_"+str(i))
for i in range(4):
dpg.delete_item("__demo_item_reg5_"+str(i))
def show_demo():
dpg.add_texture_registry(label="Demo Texture Container", tag="__demo_texture_container")
dpg.add_colormap_registry(label="Demo Colormap Registry", tag="__demo_colormap_registry")
with dpg.theme(tag="__demo_hyperlinkTheme"):
with dpg.theme_component(dpg.mvButton):
dpg.add_theme_color(dpg.mvThemeCol_Button, [0, 0, 0, 0])
dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, [0, 0, 0, 0])
dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, [29, 151, 236, 25])
dpg.add_theme_color(dpg.mvThemeCol_Text, [29, 151, 236])
def _log(sender, app_data, user_data):
print(f"sender: {sender}, \t app_data: {app_data}, \t user_data: {user_data}")
_create_static_textures()
_create_dynamic_textures()
with dpg.window(label="Dear PyGui Demo", width=800, height=800, on_close=_on_demo_close, pos=(100, 100), tag="__demo_id"):
with dpg.menu_bar():
with dpg.menu(label="Menu"):
dpg.add_text("This menu is just for show!")
dpg.add_menu_item(label="New")
dpg.add_menu_item(label="Open")
with dpg.menu(label="Open Recent"):
dpg.add_menu_item(label="harrel.c")
dpg.add_menu_item(label="patty.h")
dpg.add_menu_item(label="nick.py")
dpg.add_menu_item(label="Save")
dpg.add_menu_item(label="Save As...")
with dpg.menu(label="Settings"):
dpg.add_menu_item(label="Option 1", callback=_log)
dpg.add_menu_item(label="Option 2", check=True, callback=_log)
dpg.add_menu_item(label="Option 3", check=True, default_value=True, callback=_log)
with dpg.child_window(height=60, autosize_x=True, delay_search=True):
for i in range(10):
dpg.add_text(f"Scolling Text{i}")
dpg.add_slider_float(label="Slider Float")
dpg.add_input_int(label="Input Int")
dpg.add_combo(("Yes", "No", "Maybe"), label="Combo")
with dpg.menu(label="Tools"):
dpg.add_menu_item(label="Show About", callback=lambda:dpg.show_tool(dpg.mvTool_About))
dpg.add_menu_item(label="Show Metrics", callback=lambda:dpg.show_tool(dpg.mvTool_Metrics))
dpg.add_menu_item(label="Show Documentation", callback=lambda:dpg.show_tool(dpg.mvTool_Doc))
dpg.add_menu_item(label="Show Debug", callback=lambda:dpg.show_tool(dpg.mvTool_Debug))
dpg.add_menu_item(label="Show Style Editor", callback=lambda:dpg.show_tool(dpg.mvTool_Style))
dpg.add_menu_item(label="Show Font Manager", callback=lambda:dpg.show_tool(dpg.mvTool_Font))
dpg.add_menu_item(label="Show Item Registry", callback=lambda:dpg.show_tool(dpg.mvTool_ItemRegistry))
with dpg.menu(label="Settings"):
dpg.add_menu_item(label="Wait For Input", check=True, callback=lambda s, a: dpg.configure_app(wait_for_input=a))
dpg.add_menu_item(label="Toggle Fullscreen", callback=lambda:dpg.toggle_viewport_fullscreen())
with dpg.group(horizontal=True):
dpg.add_loading_indicator(circle_count=4)
with dpg.group():
dpg.add_text(f'Dear PyGui says hello. ({dpg.get_dearpygui_version()})')
with dpg.group(horizontal=True):
dpg.add_text("The code for the most recent version of this demo can be found here:")
_hyperlink("demo.py", "https://github.com/hoffstadt/DearPyGui/blob/master/dearpygui/demo.py")
with dpg.collapsing_header(label="Window Options"):
_add_config_options("__demo_id", 3,
"no_title_bar", "no_scrollbar", "menubar",
"no_move", "no_resize", "no_collapse",
"no_close", "no_background", "no_bring_to_front_on_focus"
)
with dpg.collapsing_header(label="Widgets"):
with dpg.tree_node(label="Basic"):
with dpg.group(horizontal=True):
dpg.add_button(label="Button", callback=_log)
dpg.add_button(label="Button", callback=_log, small=True)
dpg.add_button(label="Button", callback=_log, arrow=True) # default direction is mvDir_Up
dpg.add_button(label="Button", callback=_log, arrow=True, direction=dpg.mvDir_Left)
dpg.add_button(label="Button", callback=_log, arrow=True, direction=dpg.mvDir_Right)
dpg.add_button(label="Button", callback=_log, arrow=True, direction=dpg.mvDir_Down)
dpg.add_checkbox(label="checkbox", callback=_log)
dpg.add_radio_button(("radio a", "radio b", "radio c"), callback=_log, horizontal=True)
dpg.add_selectable(label="selectable", callback=_log)
with dpg.group(horizontal=True):
for i in range(7):
with dpg.theme(tag="__demo_theme"+str(i)):
with dpg.theme_component(dpg.mvButton):
dpg.add_theme_color(dpg.mvThemeCol_Button, _hsv_to_rgb(i/7.0, 0.6, 0.6))
dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, _hsv_to_rgb(i/7.0, 0.8, 0.8))
dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, _hsv_to_rgb(i/7.0, 0.7, 0.7))
dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, i*5)
dpg.add_theme_style(dpg.mvStyleVar_FramePadding, i*3, i*3)
dpg.add_button(label="Click", callback=_log)
dpg.bind_item_theme(dpg.last_item(), "__demo_theme"+str(i))
with dpg.group(horizontal=True):
dpg.add_text("Press a button: ")
widget = dpg.add_text("0")
dpg.add_button(arrow=True, direction=dpg.mvDir_Left, user_data=widget, callback=lambda s, a, u: dpg.set_value(u, int(dpg.get_value(u))-1))
dpg.add_button(arrow=True, direction=dpg.mvDir_Right, user_data=widget, callback=lambda s, a, u: dpg.set_value(u, int(dpg.get_value(u))+1))
dpg.add_text("hover me")
with dpg.tooltip(dpg.last_item()):
dpg.add_text("I'm a simple tooltip!")
dpg.add_separator()
dpg.add_text("Value", label="Label", show_label=True)
dpg.add_combo(("AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK"), label="combo", default_value="AAAA", callback=_log)
dpg.add_input_text(label="input text", default_value="Hello, world!", callback=_log)
_help(
"USER:\n"
"Hold SHIFT or use mouse to select text.\n"
"CTRL+Left/Right to word jump.\n"
"CTRL+A or double-click to select all.\n"
"CTRL+X,CTRL+C,CTRL+V clipboard.\n"
"CTRL+Z,CTRL+Y undo/redo.\n"
"ESCAPE to revert.\n\n")
dpg.add_input_text(label="input text (w/ hint)", hint="enter text here", callback=_log)
dpg.add_input_int(label="input int", callback=_log)
dpg.add_input_float(label="input float", callback=_log, format="%.06f")
dpg.add_input_float(label="input float scientific", format="%e", callback=_log)
dpg.add_input_floatx(label="input floatx", callback=_log, default_value=[1,2,3,4])
dpg.add_input_double(label="input double", callback=_log, format="%.14f")
dpg.add_input_doublex(label="input doublex", callback=_log, default_value=[1,2,3,4], format="%.14f")
dpg.add_drag_int(label="drag int", callback=_log)
_help(
"Click and drag to edit value.\n"
"Hold SHIFT/ALT for faster/slower edit.\n"
"Double-click or CTRL+click to input value.")
dpg.add_drag_int(label="drag int 0..100", format="%d%%", callback=_log)
dpg.add_drag_float(label="drag float", callback=_log)
dpg.add_drag_float(label="drag small float", default_value=0.0067, format="%.06f ns", callback=_log)
dpg.add_slider_int(label="slider int", max_value=3, callback=_log)
_help("CTRL+click to enter value.")
dpg.add_slider_float(label="slider float", max_value=1.0, format="ratio = %.3f", callback=_log)
dpg.add_slider_double(label="slider double", max_value=1.0, format="ratio = %.14f", callback=_log)
dpg.add_slider_int(label="slider angle", min_value=-360, max_value=360, format="%d deg", callback=_log)
_help(
"Click on the colored square to open a color picker.\n"
"Click and hold to use drag and drop.\n"
"Right-click on the colored square to show options.\n"
"CTRL+click on individual component to input value.\n")
dpg.add_color_edit((102, 179, 0, 128), label="color edit 4", callback=_log)
dpg.add_color_edit(default_value=(.5, 1, .25, .1), label="color edit 4", callback=_log)
dpg.add_listbox(("Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon"), label="listbox", num_items=4, callback=_log)
dpg.add_color_button()
with dpg.tree_node(label="Combo"):
items = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
combo_id = dpg.add_combo(items, label="combo", height_mode=dpg.mvComboHeight_Small)
_add_config_options(combo_id, 1, "popup_align_left", "no_arrow_button", "no_preview")
with dpg.tree_node(label="Color Picker & Edit"):
_color_picker_id = dpg.generate_uuid()
_color_edit_id = dpg.generate_uuid()
def _color_picker_configs(sender, value, user_data):
_old_config = dpg.get_item_configuration(user_data)
if user_data ==_color_picker_id:
picker_mode = _old_config["picker_mode"]
else:
display_mode = _old_config["display_mode"]
alpha_preview = _old_config["alpha_preview"]
display_type = _old_config["display_type"]
input_mode = _old_config["input_mode"]
# picker_mode
if value == "mvColorPicker_bar":
picker_mode=dpg.mvColorPicker_bar
elif value == "mvColorPicker_wheel":
picker_mode = dpg.mvColorPicker_wheel
# alpha_preview
elif value == "mvColorEdit_AlphaPreviewNone":
alpha_preview=dpg.mvColorEdit_AlphaPreviewNone
elif value == "mvColorEdit_AlphaPreview":
alpha_preview = dpg.mvColorEdit_AlphaPreview
elif value == "mvColorEdit_AlphaPreviewHalf":
alpha_preview = dpg.mvColorEdit_AlphaPreviewHalf
# display_type
elif value == "mvColorEdit_uint8":
display_type=dpg.mvColorEdit_uint8
elif value == "mvColorEdit_float":
display_type = dpg.mvColorEdit_float
# display_type
elif value == "mvColorEdit_uint8":
display_type=dpg.mvColorEdit_uint8
elif value == "mvColorEdit_float":
display_type = dpg.mvColorEdit_float
# display_mode
elif value == "mvColorEdit_rgb":
display_mode=dpg.mvColorEdit_rgb
elif value == "mvColorEdit_hsv":
display_mode = dpg.mvColorEdit_hsv
elif value == "mvColorEdit_hex":
display_mode = dpg.mvColorEdit_hex
if user_data ==_color_picker_id:
dpg.configure_item(user_data,
picker_mode=picker_mode,
alpha_preview=alpha_preview,
display_type=display_type,
input_mode=input_mode
)
else:
dpg.configure_item(user_data,
alpha_preview=alpha_preview,
display_type=display_type,
input_mode=input_mode,
display_mode=display_mode
)
dpg.add_text("Color Picker")
with dpg.group(horizontal=True):
_before_id = dpg.add_text("picker_mode:")
dpg.add_radio_button(("mvColorPicker_bar", "mvColorPicker_wheel"), callback=_color_picker_configs,
user_data=_color_picker_id, horizontal=True)
with dpg.group(horizontal=True):
dpg.add_text("alpha_preview:")
dpg.add_radio_button(("mvColorEdit_AlphaPreviewNone", "mvColorEdit_AlphaPreview", "mvColorEdit_AlphaPreviewHalf"), callback=_color_picker_configs,
user_data=_color_picker_id, horizontal=True)
with dpg.group(horizontal=True):
dpg.add_text("display_type:")
dpg.add_radio_button(("mvColorEdit_uint8", "mvColorEdit_float"), callback=_color_picker_configs,
user_data=_color_picker_id, horizontal=True)
with dpg.group(horizontal=True):
dpg.add_text("input_mode:")
dpg.add_radio_button(("mvColorEdit_input_rgb", "mvColorEdit_input_hsv"), callback=_color_picker_configs,
user_data=_color_picker_id, horizontal=True)
dpg.add_color_picker((255, 0, 255, 255), label="Color Picker",
width=200, tag=_color_picker_id)
_add_config_options(_color_picker_id, 3,
"no_alpha", "no_side_preview", "display_rgb",
"display_hsv", "display_hex",
"no_small_preview", "no_inputs", "no_tooltip",
"no_label", "alpha_bar", before=_before_id)
dpg.add_separator()
dpg.add_text("Color Edit")
with dpg.group(horizontal=True):
_before_id = dpg.add_text("alpha_preview:")
dpg.add_radio_button(("mvColorEdit_AlphaPreviewNone", "mvColorEdit_AlphaPreview", "mvColorEdit_AlphaPreviewHalf"), callback=_color_picker_configs,
user_data=_color_edit_id, horizontal=True)
with dpg.group(horizontal=True):
dpg.add_text("display_type:")
dpg.add_radio_button(("mvColorEdit_uint8", "mvColorEdit_float"), callback=_color_picker_configs,
user_data=_color_edit_id, horizontal=True)
with dpg.group(horizontal=True):
dpg.add_text("display_mode:")
dpg.add_radio_button(("mvColorEdit_rgb", "mvColorEdit_hsv", "mvColorEdit_hex"), callback=_color_picker_configs,
user_data=_color_edit_id, horizontal=True)
with dpg.group(horizontal=True):
dpg.add_text("input_mode:")
dpg.add_radio_button(("mvColorEdit_input_rgb", "mvColorEdit_input_hsv"), callback=_color_picker_configs,
user_data=_color_edit_id, horizontal=True)
dpg.add_color_edit((255, 0, 255, 255), label="Color Edit",
width=200, tag=_color_edit_id)
_add_config_options(_color_edit_id, 3,
"no_alpha", "no_picker",
"no_options", "no_inputs", "no_small_preview",
"no_tooltip", "no_label",
"no_drag_drop", "alpha_bar", before=_before_id)
with dpg.tree_node(label="Colormaps"):
dpg.add_text("Notes")
dpg.add_text("Colormaps belong to a mvColorMapRegistry.", bullet=True, indent=20)
with dpg.group(horizontal=True):
dpg.add_text("Showing the registry will help with debugging. Press ", bullet=True, indent=20)
dpg.add_button(label="here", small=True, callback=lambda:dpg.show_item("__demo_colormap_registry"))
dpg.add_text("Colormaps are applied with 'bind_colormap(item_id, colormap_id)", bullet=True, indent=20)
dpg.add_text("Colormaps can be applied to mvPlot, mvColorMapButton, mvColorMapSlider, mvColorMapScale", bullet=True, indent=20)
dpg.add_text("Colormaps can be sampled with 'sample_colormap(colormap_id, t)' (0<t<1)", bullet=True, indent=20)
dpg.add_text("Colormaps can be sampled by index with 'get_colormap_color(colormap_id, index)'", bullet=True, indent=20)
dpg.add_colormap([[0, 0, 0, 255], [255, 255, 255, 255]], False, tag="__demo_colormap_1", parent="__demo_colormap_registry", label="Demo 1")
dpg.add_colormap([[255, 0, 0], [0, 255, 0], [0, 0, 255]], True, tag="__demo_colormap_2", parent="__demo_colormap_registry", label="Demo 2")
dpg.add_colormap_button(label="Colormap Button 1")
dpg.bind_colormap(dpg.last_item(), "__demo_colormap_1")
dpg.add_colormap_button(label="Colormap Button 2")
dpg.bind_colormap(dpg.last_item(), "__demo_colormap_2")
dpg.add_colormap_slider(label="Colormap Slider 1", default_value=0.5)
dpg.bind_colormap(dpg.last_item(), "__demo_colormap_1")
dpg.add_colormap_slider(label="Colormap Slider 2")
dpg.bind_colormap(dpg.last_item(), "__demo_colormap_2")
with dpg.group(horizontal=True):
dpg.add_colormap_scale(label="Colormap Slider 1")
dpg.bind_colormap(dpg.last_item(), "__demo_colormap_1")
dpg.add_colormap_scale(label="Colormap Slider 2")
dpg.bind_colormap(dpg.last_item(), "__demo_colormap_2")
dpg.add_colormap_scale(label="Colormap Spectral", min_scale=-100, max_scale=150)
dpg.bind_colormap(dpg.last_item(), dpg.mvPlotColormap_Spectral)
with dpg.tree_node(label="List Boxes"):
items = ("A","B","C","D","E","F","G","H","I","J","K","L","M" "O","P","Q","R","S","T","U","V","W","X","Y","Z")
listbox_1 = dpg.add_listbox(items, label="listbox 1 (full)")
listbox_2 = dpg.add_listbox(items, label="listbox 2", width=200)
dpg.add_input_int(label="num_items",callback=_config, user_data=[listbox_1, listbox_2], before = listbox_1)
dpg.add_slider_int(label="width", default_value=200, callback=_config, user_data=listbox_2, before = listbox_1, max_value=500)
with dpg.tree_node(label="Selectables"):
with dpg.tree_node(label="Basic"):
dpg.add_selectable(label="1. I am selectable")
dpg.add_text("2. I am not selectable")
with dpg.tree_node(label="Selection State: Single"):
def _selection(sender, app_data, user_data):
for item in user_data:
if item != sender:
dpg.set_value(item, False)
items = (
dpg.add_selectable(label="1. I am selectable"),
dpg.add_selectable(label="2. I am selectable"),
dpg.add_selectable(label="3. I am selectable"),
dpg.add_selectable(label="4. I am selectable"),
dpg.add_selectable(label="5. I am selectable"),
)
for item in items:
dpg.configure_item(item, callback=_selection, user_data=items)
with dpg.tree_node(label="Bullets"):
dpg.add_text("Bullet point 1", bullet=True)
dpg.add_text("Bullet point 2\nbullet text can be\nOn multiple lines", bullet=True)
with dpg.tree_node(label="Tree node"):
dpg.add_text("Another bullet point", bullet=True)
with dpg.group(horizontal=True):
dpg.add_text("1", bullet=True)
dpg.add_button(label="Button", small=True)
with dpg.tree_node(label="Text"):
with dpg.tree_node(label="Colored Text"):
dpg.add_text("Pink", color=(255, 0, 255))
dpg.add_text("Yellow", color=(255, 255, 0))
with dpg.tree_node(label="Word Wrapping"):
paragraph1 = 'This text should automatically wrap on the edge of the window.The current implementation for the text wrapping follows simple rules suited for English and possibly other languages'
paragraph2 = 'The lazy dong is a good dog. This paragraph should fit within the child. Testing a 1 character word. The quick brown fox jumps over the lazy dog.'
dpg.add_text(paragraph1, wrap=0)
widget_id = dpg.add_slider_int(label="wrap width", default_value=500, max_value=1000,
callback=lambda s, a, u: dpg.configure_item(u, wrap=a))
dpg.add_text(paragraph2, wrap=500)
dpg.configure_item(widget_id, user_data=dpg.last_item())
with dpg.tree_node(label="Text Input"):
with dpg.tree_node(label="Multi-line Text Input"):
paragraph = """/*\n
The Pentium F00F bug, shorthand for F0 0F C7 C8,\n
the hexadecimal encoding of one offending instruction,\n
more formally, the invalid operand with locked CMPXCHG8B\n
instruction bug, is a design flaw in the majority of\n
Intel Pentium, Pentium MMX, and Pentium OverDrive\n
processors (all in the P5 microarchitecture).\n
*/\n\n
label:\n
\tlock cmpxchg8b eax\n"""
dpg.add_input_text(label="input text", multiline=True, default_value=paragraph, height=300, callback=_log, tab_input=True)
_add_config_options(dpg.last_item(), 1,
"readonly", "on_enter")
with dpg.tree_node(label="Filtered Text Input"):
dpg.add_input_text(callback=_log, label="default")
dpg.add_input_text(callback=_log, label="decimal", decimal=True)
dpg.add_input_text(callback=_log, label="no blank", no_spaces=True)
dpg.add_input_text(callback=_log, label="uppercase", uppercase=True)
dpg.add_input_text(callback=_log, label="scientific", scientific=True)
dpg.add_input_text(callback=_log, label="hexdecimal", hexadecimal=True)
with dpg.tree_node(label="Password Input"):
password = dpg.add_input_text(label="password", password=True, callback=_log)
dpg.add_input_text(label="password (w/ hint)", password=True, hint="<password>", source=password, callback=_log)
dpg.add_input_text(label="password (clear)", source=password, callback=_log)
with dpg.tree_node(label="Simple Plots"):
data = (0.6, 0.1, 1.0, 0.5, 0.92, 0.1, 0.2)
dpg.add_simple_plot(label="Frame Times", default_value=data)
dpg.add_simple_plot(label="Histogram", default_value=data, height=80, histogram=True, min_scale=0.0)
data1 = []
for i in range(70):
data1.append(cos(3.14*6*i/180))
dpg.add_simple_plot(label="Lines", default_value=data1, height=80)
dpg.add_simple_plot(label="Histogram", default_value=data1, height=80, histogram=True)
with dpg.group(horizontal=True):
dpg.add_progress_bar(label="Progress Bar", default_value=0.78, overlay="78%")
dpg.add_text("Progress Bar")
with dpg.theme(tag="__demo_theme_progressbar"):
with dpg.theme_component(dpg.mvProgressBar):
dpg.add_theme_color(dpg.mvThemeCol_PlotHistogram, (255,0,0, 255))
dpg.add_progress_bar(default_value=0.78, overlay="1367/1753")
dpg.bind_item_theme(dpg.last_item(), "__demo_theme_progressbar")
with dpg.tree_node(label="Multi-component Widgets"):
for i in range(2, 5):
with dpg.group():
float_source = dpg.add_input_floatx(label=f"input float {i}", min_value=0.0, max_value=100.0, size=i)
dpg.add_drag_floatx(label=f"drag float {i}", source=float_source, size=i)
dpg.add_slider_floatx(label=f"slider float {i}", source=float_source, size=i)
with dpg.group():
double_source = dpg.add_input_doublex(label=f"input double {i}", min_value=0.0, max_value=100.0, size=i)
dpg.add_drag_doublex(label=f"drag double {i}", source=double_source, size=i)
dpg.add_slider_doublex(label=f"slider double {i}", source=double_source, size=i)
with dpg.group():
int_source = dpg.add_input_intx(label=f"input int {i}", min_value=0, max_value=100, size=i)
dpg.add_drag_intx(label=f"drag int {i}", source=int_source, size=i)
dpg.add_slider_intx(label=f"slider int {i}", source=int_source, size=i)
dpg.add_spacer(height=10)
with dpg.tree_node(label="Vertical Sliders"):
with dpg.group(horizontal=True):
dpg.add_slider_int(label=" ", default_value=1, vertical=True, max_value=5, height=160)
dpg.add_slider_double(label=" ", default_value=1.0, vertical=True, max_value=5.0, height=160)
with dpg.group(horizontal=True):
with dpg.group(horizontal=True):
values = [ 0.0, 0.60, 0.35, 0.9, 0.70, 0.20, 0.0 ]
for i in range(7):
with dpg.theme(tag="__demo_theme2_"+str(i)):
with dpg.theme_component(0):
dpg.add_theme_color(dpg.mvThemeCol_FrameBg, _hsv_to_rgb(i/7.0, 0.5, 0.5))
dpg.add_theme_color(dpg.mvThemeCol_SliderGrab, _hsv_to_rgb(i/7.0, 0.9, 0.9))
dpg.add_theme_color(dpg.mvThemeCol_FrameBgActive, _hsv_to_rgb(i/7.0, 0.7, 0.5))
dpg.add_theme_color(dpg.mvThemeCol_FrameBgHovered, _hsv_to_rgb(i/7.0, 0.6, 0.5))
dpg.add_slider_float(label=" ", default_value=values[i], vertical=True, max_value=1.0, height=160)
dpg.bind_item_theme(dpg.last_item(), "__demo_theme2_"+str(i))
with dpg.group():
for i in range(3):
with dpg.group(horizontal=True):
values = [ 0.20, 0.80, 0.40, 0.25 ]
for j in range(4):
dpg.add_slider_float(label=" ", default_value=values[j], vertical=True, max_value=1.0, height=50)
with dpg.group(horizontal=True):
dpg.add_slider_float(label=" ", vertical=True, max_value=1.0, height=160, width=40)
dpg.add_slider_float(label=" ", vertical=True, max_value=1.0, height=160, width=40)
dpg.add_slider_float(label=" ", vertical=True, max_value=1.0, height=160, width=40)
dpg.add_slider_float(label=" ", vertical=True, max_value=1.0, height=160, width=40)
with dpg.tree_node(label="Time/Date Widgets"):
dpg.add_time_picker(default_value={'hour': 14, 'min': 32, 'sec': 23})
dpg.add_separator()
with dpg.table(header_row=False):
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
with dpg.table_row():
dpg.add_date_picker(level=dpg.mvDatePickerLevel_Day, default_value={'month_day': 8, 'year':93, 'month':5})
dpg.add_date_picker(level=dpg.mvDatePickerLevel_Month, default_value={'month_day': 8, 'year':93, 'month':5})
dpg.add_date_picker(level=dpg.mvDatePickerLevel_Year, default_value={'month_day': 8, 'year':93, 'month':5})
with dpg.tree_node(label="Loading Indicators"):
with dpg.group(horizontal=True):
dpg.add_loading_indicator()
dpg.add_loading_indicator(style=1)
with dpg.tree_node(label="Knobs"):
with dpg.group(horizontal=True):
dpg.add_knob_float(label="K1")
dpg.add_knob_float(label="K2", default_value=25.0)
dpg.add_knob_float(label="K3", default_value=50.0)
with dpg.tree_node(label="2D/3D Sliders"):
dpg.add_3d_slider(label="3D Slider", scale=0.5)
with dpg.collapsing_header(label="Layout & Scrolling"):
with dpg.tree_node(label="Widgets Width"):
dpg.add_text("Width=100")
dpg.add_drag_float(label="float", width=100)
dpg.add_text("Width=-100")
dpg.add_drag_float(label="float", width=-100)
dpg.add_text("Width=-1")
dpg.add_drag_float(label="float", width=-1)
dpg.add_text("group with width=75")
with dpg.group(width=75):
dpg.add_drag_float(label="float")
dpg.add_drag_float(label="float")
dpg.add_drag_float(label="float")
with dpg.tree_node(label="Basic Horizontal Layout"):
dpg.add_text("(Use groups with horizontal set to True to keep adding items to the right of the preceding item)", bullet=True)
with dpg.group(horizontal=True):
dpg.add_text("Normal buttons")
dpg.add_button(label="Banana")
dpg.add_button(label="Apple")
dpg.add_button(label="Corniflower")
with dpg.group(horizontal=True):
dpg.add_text("Small buttons")
dpg.add_button(label="Like this one", small=True)
dpg.add_text("can fit within a text block")
with dpg.group(horizontal=True, xoffset=150):
dpg.add_text("Aligned")
dpg.add_text("x=150")
dpg.add_text("x=300")
with dpg.group(horizontal=True, xoffset=150):
dpg.add_text(default_value="Aligned")
dpg.add_button(label="x=150", small=True)
dpg.add_button(label="x=300", small=True)
with dpg.group(horizontal=True):
dpg.add_checkbox(label="My")
dpg.add_checkbox(label="Tailor")
dpg.add_checkbox(label="is")
dpg.add_checkbox(label="rich")
dpg.add_text("Lists:")
with dpg.group(horizontal=True):
dpg.add_listbox(("AAAA", "BBBB", "CCCC", "DDDD"), default_value="AAAA", width=100, label="")
dpg.add_listbox(("AAAA", "BBBB", "CCCC", "DDDD"), default_value="BBBB", width=100, label="")
dpg.add_listbox(("AAAA", "BBBB", "CCCC", "DDDD"), default_value="CCCC", width=100, label="")
dpg.add_listbox(("AAAA", "BBBB", "CCCC", "DDDD"), default_value="DDDD", width=100, label="")
dpg.add_text("Spacing(100):")
with dpg.group(horizontal=True, horizontal_spacing=100):
dpg.add_button(label="A", width=50, height=50)
dpg.add_button(label="B", width=50, height=50)
with dpg.tree_node(label="Ordered pack style"):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.tree_node(label="Absolute Position Placement"):
dpg.add_button(label="Set Button 2 Pos", callback=lambda: dpg.set_item_pos(B2, (50, 125)))
dpg.add_button(label="Reset Button 2 Pos", callback=lambda: dpg.reset_pos(B2))
dpg.add_button(label="Button 1", pos=[50,50], width=75, height=75)
B2 = dpg.add_button(label="Button 2", width=75, height=75)
dpg.add_button(label="Button 3")
with dpg.tree_node(label="Grid Layout using Table API"):
layout_demo_table = dpg.generate_uuid()
dpg.add_text("Tables can be used to layout items in an equally spaced grid pattern.")
dpg.add_text("See tables section for more detail on tables.")
dpg.add_checkbox(label="resizable", callback=_config, user_data=layout_demo_table)
dpg.add_checkbox(label="borders_innerH", callback=_config, user_data=layout_demo_table, default_value=True)
dpg.add_checkbox(label="borders_outerH", callback=_config, user_data=layout_demo_table, default_value=True)
dpg.add_checkbox(label="borders_innerV", callback=_config, user_data=layout_demo_table, default_value=True)
dpg.add_checkbox(label="borders_outerV", callback=_config, user_data=layout_demo_table, default_value=True)
with dpg.table(tag=layout_demo_table, header_row=False, borders_innerH=True,
borders_outerH=True, borders_innerV=True, borders_outerV=True):
dpg.add_table_column()
dpg.add_table_column()
dpg.add_table_column()
with dpg.table_row():
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.table_row():
dpg.add_table_cell()
dpg.add_button(label="Button 4")
dpg.add_button(label="Button 5")
with dpg.tree_node(label="Containers"):
with dpg.tree_node(label="Tree Nodes"):
with dpg.tree_node(label="Tree Node (selectable)", selectable=True):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.tree_node(label="Tree Node (bullet)", bullet=True):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.tree_node(label="Groups"):
dpg.add_text("Groups are used to control child items placement, width, and provide a hit box for things like is the set of items are hovered, ect...")
with dpg.group(horizontal=True):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.group(width=150):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.group():
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.tree_node(label="Child windows"):
demo_layout_child = dpg.generate_uuid()
dpg.add_text("Child windows are basically embedded windows and provide much more structure and control of the containing items than groups.")
with dpg.group(horizontal=True):
dpg.add_checkbox(label="autosize_x", callback=_config, user_data=demo_layout_child)
dpg.add_checkbox(label="autosize_y", callback=_config, user_data=demo_layout_child)
dpg.add_checkbox(label="menubar", callback=_config, user_data=demo_layout_child)
dpg.add_checkbox(label="no_scrollbar", callback=_config, user_data=demo_layout_child)
dpg.add_checkbox(label="horizontal_scrollbar", callback=_config, user_data=demo_layout_child)
dpg.add_checkbox(label="border", default_value=True, callback=_config, user_data=demo_layout_child)
with dpg.child_window(tag=demo_layout_child, width=200, height=200):
with dpg.menu_bar():
with dpg.menu(label="Menu"):
pass
for i in range(20):
dpg.add_text(default_value="A pretty long sentence if you really think about it. It's also pointless. we need this to be even longer")
with dpg.child_window(autosize_x=True, height=130, menubar=True):
with dpg.menu_bar():
dpg.add_menu(label="Menu Options")
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.group(horizontal=True):
with dpg.child_window(width=100, height=150, horizontal_scrollbar=True):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
dpg.add_button(label="Button 4", width=150)
dpg.add_button(label="Button 5")
dpg.add_button(label="Button 6")
with dpg.child_window(width=100, height=110):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.tree_node(label="Collapsing Headers"):
with dpg.collapsing_header(label="Collapsing Header"):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.collapsing_header(label="Collapsing Header (close)", closable=True):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.collapsing_header(label="Collapsing Header (bullet)", bullet=True):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.collapsing_header(label="Collapsing Header (leaf)", leaf=True):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.tree_node(label="Tabs"):
with dpg.tree_node(label="Basic"):
with dpg.tab_bar():
with dpg.tab(label="Avocado"):
dpg.add_text("This is the avocado tab!")
with dpg.tab(label="Broccoli"):
dpg.add_text("This is the broccoli tab!")
with dpg.tab(label="Cucumber"):
dpg.add_text("This is the cucumber tab!")
with dpg.tree_node(label="Advanced"):
with dpg.tab_bar() as tb:
with dpg.tab(label="tab 1"):
dpg.add_text("This is the tab 1!")
with dpg.tab(label="tab 2") as t2:
dpg.add_text("This is the tab 2!")
with dpg.tab(label="tab 3"):
dpg.add_text("This is the tab 3!")
with dpg.tab(label="tab 4"):
dpg.add_text("This is the tab 4!")
tbb = dpg.add_tab_button(label="+")
dpg.add_tab_button(label="?")
#dpg.add_checkbox(before=tb, label="tab bar reorderable", user_data=tb, callback=lambda s, a, u: dpg.configure_item(u, reorderable=dpg.get_value(s)))
#dpg.add_checkbox(before=tb, label="tab 2 no_reorder", user_data=t2, callback=lambda s, a, u: dpg.configure_item(u, no_reorder=dpg.get_value(s)))
#dpg.add_checkbox(before=tb, label="tab 2 leading", user_data=t2, callback=lambda s, a, u: dpg.configure_item(u, leading=dpg.get_value(s)))
#dpg.add_checkbox(before=tb, label="tab 2 trailing", user_data=t2, callback=lambda s, a, u: dpg.configure_item(u, trailing=dpg.get_value(s)))
#dpg.add_checkbox(before=tb, label="tab button trailing", user_data=tbb, callback=lambda s, a, u: dpg.configure_item(u, trailing=dpg.get_value(s)))
#dpg.add_checkbox(before=tb, label="tab button leading", user_data=tbb, callback=lambda s, a, u: dpg.configure_item(u, leading=dpg.get_value(s)))
with dpg.tree_node(label="Simple Layouts"):
dpg.add_text("Containers can be nested for advanced layout options")
with dpg.child_window(width=500, height=320, menubar=True):
with dpg.menu_bar():
dpg.add_menu(label="Menu Options")
with dpg.child_window(autosize_x=True, height=95):
with dpg.group(horizontal=True):
dpg.add_button(label="Header 1", width=75, height=75)
dpg.add_button(label="Header 2", width=75, height=75)
dpg.add_button(label="Header 3", width=75, height=75)
with dpg.child_window(autosize_x=True, height=175):
with dpg.group(horizontal=True, width=0):
with dpg.child_window(width=102, height=150):
with dpg.tree_node(label="Nav 1"):
dpg.add_button(label="Button 1")
with dpg.tree_node(label="Nav 2"):
dpg.add_button(label="Button 2")
with dpg.tree_node(label="Nav 3"):
dpg.add_button(label="Button 3")
with dpg.child_window(width=300, height=150):
dpg.add_button(label="Button 1")
dpg.add_button(label="Button 2")
dpg.add_button(label="Button 3")
with dpg.child_window(width=50, height=150):
dpg.add_button(label="B1", width=25, height=25)
dpg.add_button(label="B2", width=25, height=25)
dpg.add_button(label="B3", width=25, height=25)
with dpg.group(horizontal=True):
dpg.add_button(label="Footer 1", width=175)
dpg.add_text("Footer 2")
dpg.add_button(label="Footer 3", width=175)
with dpg.tree_node(label="Scrolling"):
def _update_xscroll_info(sender, app_data, user_data):
with dpg.mutex():
x_scroll = dpg.get_x_scroll(user_data[1])
max_scroll = dpg.get_x_scroll_max(user_data[1])
dpg.set_value(user_data[0], str(x_scroll) + "/" + str(max_scroll))