Skip to content

Instantly share code, notes, and snippets.

@chozabu
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chozabu/57c1a5ee96f2ea08b692 to your computer and use it in GitHub Desktop.
Save chozabu/57c1a5ee96f2ea08b692 to your computer and use it in GitHub Desktop.
testing zorder in kivy
from kivy.uix.widget import Widget
from random import randint
def getzs(tw):
zs = []
for i in tw.children:
zs.append(i.zindy)
return zs
order = [1,0,9,3,7,5,4,6,8,2]
a=Widget()
for i in range(10):
neww = Widget()
neww.zindy = order[i]
a.add_widget(neww, index=neww.zindy)
#print item.inserted and children.after.insertion
print neww.zindy, getzs(a)
'''
final order:
[0, 1, 2, 9, 3, 4, 7, 6, 5, 8]
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment