Beispiel #1
0
 def looper():
     for i in range(20):
         placerator()
         statsloop = stellerator()
         print ("In loop, tuple passed to star: ", statsloop)
         sh.star(statsloop[0], statsloop[1], statsloop[2])
         i =+ 1
Beispiel #2
0
def test(size, color, fill='Default'):  # runs all shapes
    sh.triangle(size, color)
    #forward(300)
    sh.square(size, color)
    #forward(300)
    sh.pentagon(size, color)
    #forward(300)
    sh.hexagon(size, color)
    #forward(300)
    sh.octagon(size, color)
    #forward(300)
    sh.star(size, color)
    #forward(300)
    sh.circler(size, color)
import shapes

shapes.octagon()
shapes.circlery()
shapes.square()
shapes.hexagon()
shapes.star()
shapes.triangle()

mainloop()
Beispiel #4
0
    from glagg import PathCollection
    from shapes import star, asterisk

    glut.glutInit(sys.argv)
    glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB
                             | glut.GLUT_DEPTH)
    glut.glutInitWindowSize(512, 512)
    glut.glutCreateWindow("Dashed stars")
    glut.glutDisplayFunc(on_display)
    glut.glutReshapeFunc(on_reshape)
    glut.glutKeyboardFunc(on_keyboard)
    glut.glutIdleFunc(on_idle)

    t0, frames, t = 0, 0, 0
    t0 = glut.glutGet(glut.GLUT_ELAPSED_TIME)

    collection = PathCollection()
    vertices = star(n=5)
    for i in range(2000):
        collection.append(vertices,
                          closed=True,
                          color=np.random.uniform(0, 1, 4),
                          linewidth=np.random.uniform(1, 2),
                          translate=np.random.uniform(0, 1, 2),
                          scale=np.random.uniform(10, 15),
                          rotate=np.random.uniform(0, 2 * np.pi),
                          dash_pattern='dotted')
    positions = collection.translate.copy()
    glut.glutMainLoop()
Beispiel #5
0
def on_reshape(width, height):
    gl.glViewport(0, 0, width, height)

# -------------------------------------
def on_keyboard(key, x, y):
    if key == '\033': sys.exit()


# -----------------------------------------------------------------------------
if __name__ == '__main__':
    import sys
    import OpenGL.GLUT as glut
    from shapes import star, asterisk
    from glagg import PathCollection

    glut.glutInit(sys.argv)
    glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB)
    glut.glutInitWindowSize(800, 800)
    glut.glutCreateWindow("Error case 1")
    glut.glutDisplayFunc(on_display)
    glut.glutReshapeFunc(on_reshape)
    glut.glutKeyboardFunc(on_keyboard)

    collection = PathCollection()
    vertices = star(n=25)
    collection.append( vertices, closed=True, linewidth=15, color = (0,0,0,1),
                       linejoin = 'miter', miter_limit=15.0,
                       translate=(400,400), scale=300)

    glut.glutMainLoop()
down()

shapes.hexagon(80)

up()
left(60)
forward(360)
down()

shapes.octagon(65)

up()
left(45)
forward(60)
left(90)
forward(250)
left(18)
down()

shapes.star(200)

up()
left(50)
forward(400)
down()

shapes.cir(85)

mainloop()

Beispiel #7
0
    glut.glutInit(sys.argv)
    glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB |
                             glut.GLUT_DEPTH  | glut.GLUT_STENCIL )
    glut.glutInitWindowSize(800, 800)
    glut.glutCreateWindow("Clipping demo")
    glut.glutDisplayFunc(on_display)
    glut.glutReshapeFunc(on_reshape)
    glut.glutKeyboardFunc(on_keyboard)
    glut.glutIdleFunc(on_idle)

    collection = PathCollection()
    mask = PathCollection()
    size = 800

    collection.clear()
    vertices = star(n=5)
    for i in range(2000):
        collection.append(
            vertices, closed=True,
            color = np.random.uniform(0,1,4),
            linewidth = np.random.uniform(1,2),
            translate = np.random.uniform(0,1,2),
            scale = np.random.uniform(10,15),
            rotate = np.random.uniform(0,2*np.pi))
    positions = collection.translate.copy()

    mask.clear()
    mask.append( vertices, closed=True,
                 color = (0,0,0,1), linewidth=100,
                 translate=(size/2, size/2), scale=size * 0.4)
Beispiel #8
0
import shapes
from turtle import mainloop

shapes.startPoint()

shapes.star(100, True, 'red')

shapes.square(100, False, 'blue')

shapes.hexagon(100, True, 'beige')

shapes.circle(100, True, 'purple')

shapes.pentagon(100, False, 'white')

shapes.octagon(100, True, 'Green')

shapes.triangle(100, True, 'yellow')

mainloop()
Beispiel #9
0
import shapes

if __name__ == "__main__":
    shapes.polygon(3, 80, True, "red", "green")
    shapes.polygon(4, 100, False, "black")
    shapes.polygon(5, 80, False, "blue")
    shapes.polygon(6, 60, True, "yellow", "purple")
    shapes.polygon(8, 50, False, "black")
    shapes.star(100, False, "red")
    shapes.cir(80, True, "black", "white")
Beispiel #10
0
#!usr/bin/env python3

import shapes as s

# use all of shapes' functions to print everything ontop of each other
# all parameters have defaults
# paramater order size, "color", fill, wait
s.equilateral_triangle(200, "red", True)
s.square(200, "black")
s.pentagon(120, "purple", True)
s.hexagon(120)
s.octagon(color="blue")
s.star(300, "yellow")
s.circle(wait=True)
from turtle import *
import shapes
import math
from random import randint

speed(0)
bgcolor("black")
home()
for i in range(1, 1001):
    up()
    if i % 10 == 0:
        home()
    size = randint(5, 15)
    x = randint(-600, 600)
    y = randint(-600, 600)
    setheading(randint(0, 300))
    if (i % 2 == 0):
        forward(x)
    else:
        forward(y)
    down()
    shapes.star(size, "grey", True)
mainloop()
Beispiel #12
0
#!usr/bin/env python3

import shapes as s

# use all of shapes' functions to print everything ontop of each other
s.equilateral_triangle()
s.square()
s.pentagon()
s.hexagon()
s.octagon()
s.star()
s.circle(wait=True)