CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
DiffTreeWidget.py46 linesDownload Raw Back to examples
1 2"""3Simple use of DiffTreeWidget to display differences between structures of 4nested dicts, lists, and arrays.5"""6 7import numpy as np8 9import pyqtgraph as pg10 11app = pg.mkQApp("DiffTreeWidget Example")12A = {13    'a list': [1,2,2,4,5,6, {'nested1': 'aaaa', 'nested2': 'bbbbb'}, "seven"],14    'a dict': {15        'x': 1,16        'y': 2,17        'z': 'three'18    },19    'an array': np.random.randint(10, size=(40,10)),20    #'a traceback': some_func1(),21    #'a function': some_func1,22    #'a class': pg.DataTreeWidget,23}24 25B = {26    'a list': [1,2,3,4,5,5, {'nested1': 'aaaaa', 'nested2': 'bbbbb'}, "seven"],27    'a dict': {28        'x': 2,29        'y': 2,30        'z': 'three',31        'w': 532    },33    'another dict': {1:2, 2:3, 3:4},34    'an array': np.random.randint(10, size=(40,10)),35}36 37tree = pg.DiffTreeWidget()38tree.setData(A, B)39tree.show()40tree.setWindowTitle('pyqtgraph example: DiffTreeWidget')41tree.resize(1000, 800)42 43 44if __name__ == '__main__':45    pg.exec()46 
Aluode/PerceptionLabPortable · CoolFace