Skip to content

Commit

Permalink
Py3 bug in tools.py. Made examples Py3-compatibles
Browse files Browse the repository at this point in the history
  • Loading branch information
Zulko committed Jan 31, 2015
1 parent 67bdf3a commit 1dc3f66
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
13 changes: 10 additions & 3 deletions examples/_run_all_examples.py
Expand Up @@ -4,7 +4,14 @@


import os
examples = [f for f in os.listdir('.') if f.endswith(".py")
and not f.startswith('_')]


def execfile(filename):
exec(compile(open(filename, "rb").read(), filename, 'exec'))

examples = [f for f in os.listdir('.') if f.endswith(".py") and
not f.startswith('_')]

for f in examples:
execfile(f)
print ("running: "+f)
exec("import "+f[:-3])
1 change: 1 addition & 0 deletions examples/logo.py
Expand Up @@ -25,6 +25,7 @@

gradient=gz.ColorGradient('radial', [(0,(.3,.2,.8)),(1,(.4,.6,.8))],
xy1=(0,0), xy2=(0,r/3), xy3=(0,r))

triangle = gz.regular_polygon(r, n=3,fill=gradient, stroke=(0,0,0),
stroke_width=3, xy = (r,0))

Expand Down
2 changes: 1 addition & 1 deletion examples/roses.py
Expand Up @@ -23,7 +23,7 @@ def rose(d, n):

def position(d, n):
""" Defines the (x,y) position of the rose(d,n)."""
return [1.1*(2*i-.6)*rose_radius for i in [d, n]]
return [(1.1*(2*i-.6) * rose_radius) for i in [d, n]]

W, H = [int(c+2*rose_radius) for c in position(max_d,max_n)]

Expand Down
2 changes: 1 addition & 1 deletion gizeh/tools.py
Expand Up @@ -5,4 +5,4 @@ def htmlcolor_to_rgb(string):
raise ValueError("Bad html color format. Expected: '#RRGGBB' ")


return [1.0*int(n,16)/255 for n in string[:2], string[2:4], string[4:]]
return [1.0*int(n,16)/255 for n in (string[:2], string[2:4], string[4:])]

0 comments on commit 1dc3f66

Please sign in to comment.