Package: treeview-karjakak
TreeViewWriting an outline note with tree-view look.Installationpip install treeview-karjakakUsagefromtreeviewimportTreeView,conftv# To configure the childs (by default 50 childs, and 4 spaces)TreeView=conftv(TreeView,5,1)print(dict(TreeView.childs))w='Amazing Grace'withTreeView('test')astv:# First time write on note as parenttv.writetree(w)# Write it with loop in childsforiinrange(5):tv.quickchild(w,child=f'child{i+1}')# Edit the parenttv.edittree('Amazing Grace, how sweet the sound')print('-'*12)tv.readtree()print('-'*12)# Edit again in row 4 to child2tv.edittree('Mantaaaaaaap!',row=4,child='child2')print('-'*12)tv.readtree()print('-'*12)# Write new parenttv.addparent('Wow good job')print('-'*12)tv.readtree()print('-'*12)# Edit again in row 6 to child5tv.edittree('Wow good job buddy',row=6,child='child5')print('-'*12)tv.readtree()print('-'*12)# Write again new childstv.quickchild('Totally awesome',child='child1')print('-'*12)tv.readtree()print('-'*12)tv.quickchild('This is quick child edit',child='child2')print('-'*12)tv.readtree()print('-'*12)tv.quickchild('Thank You',child='child1')print('-'*12)tv.readtree()print('-'*12)# Delete row 10tv.delrow(10)print('-'*12)tv.readtree()print('-'*12)# Insert to row 8 as child1tv.insertrow('God bless you',row=8,child='child1')print('-'*12)tv.readtree()print('-'*12)# Moving position from row 6 to row 4tv.movetree(6,4)print('-'*12)tv.readtree()print('-'*12)# Moving position of child in row 6 as child1tv.movechild(6,child='child1')print('-'*12)tv.readtree()print('-'*12)# Print an iterator to dictpprint(dict(tv.insighttree()))# Create spaces between rowsforiinrange(1,tv.getdatanum()+4,2):ifi==15:breaktv.insertspace(i)print('-'*12)tv.readtree()print('-'*12)pprint(dict(tv.insighttree()))# Backup note as json filetv.backuptv()deltv,w,iResult:{'child1':1,'child2':2,'child3':3,'child4':4,'child5':5}------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-AmazingGrace-AmazingGrace------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Mantaaaaaaap!-AmazingGrace------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Mantaaaaaaap!-AmazingGraceWowgoodjob:------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Mantaaaaaaap!-AmazingGrace-WowgoodjobbuddyWowgoodjob:------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Mantaaaaaaap!-AmazingGrace-WowgoodjobbuddyWowgoodjob:-Totallyawesome------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Mantaaaaaaap!-AmazingGrace-WowgoodjobbuddyWowgoodjob:-Totallyawesome-Thisisquickchildedit------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Mantaaaaaaap!-AmazingGrace-WowgoodjobbuddyWowgoodjob:-Totallyawesome-Thisisquickchildedit-ThankYou------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Mantaaaaaaap!-AmazingGrace-WowgoodjobbuddyWowgoodjob:-Totallyawesome-ThankYou------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Mantaaaaaaap!-AmazingGrace-Wowgoodjobbuddy-GodblessyouWowgoodjob:-Totallyawesome-ThankYou------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Wowgoodjobbuddy-Mantaaaaaaap!-AmazingGrace-GodblessyouWowgoodjob:-Totallyawesome-ThankYou------------------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Wowgoodjobbuddy-Mantaaaaaaap!-AmazingGrace-GodblessyouWowgoodjob:-Totallyawesome-ThankYou------------{0:('parent','Amazing Grace, how sweet the sound:\n'),1:('child1','-Amazing Grace\n'),2:('child2','-Amazing Grace\n'),3:('child3','-Amazing Grace\n'),4:('child5','-Wow good job buddy\n'),5:('child2','-Mantaaaaaaap!\n'),6:('child1','-Amazing Grace\n'),7:('child1','-God bless you\n'),8:('space','\n'),9:('parent','Wow good job:\n'),10:('child1','-Totally awesome\n'),11:('child1','-Thank You\n')}------------AmazingGrace,howsweetthesound:-AmazingGrace-AmazingGrace-AmazingGrace-Wowgoodjobbuddy-Mantaaaaaaap!-AmazingGrace-GodblessyouWowgoodjob:-Totallyawesome-ThankYou------------{0:('parent','Amazing Grace, how sweet the sound:\n'),1:('space','\n'),2:('child1','-Amazing Grace\n'),3:('space','\n'),4:('child2','-Amazing Grace\n'),5:('space','\n'),6:('child3','-Amazing Grace\n'),7:('space','\n'),8:('child5','-Wow good job buddy\n'),9:('space','\n'),10:('child2','-Mantaaaaaaap!\n'),11:('space','\n'),12:('child1','-Amazing Grace\n'),13:('space','\n'),14:('child1','-God bless you\n'),15:('space','\n'),16:('parent','Wow good job:\n'),17:('child1','-Totally awesome\n'),18:('child1','-Thank You\n')}