コード例 #1
0
def main():
    '''
    Main loop which sets the parameters and calls the simulation
    '''  
    
    # Set the mood
    t.bgcolor('black')
    
    # Assumed scale: 100 pixels = 1AU.
    AU = 149.6e9                # 149.6 billion meters is one astronomical unit
    SCALE = 250 / AU                            # 2e-9;  100 px
    
    # Declare initial positions and velocities for two bodies
    sun_loc = np.array([0,0])
    sun_vel = np.array([0,0])
    
    earth_loc = np.array([-0.9*AU, 0])
    earth_vel = np.array([0, 35000])              # shows elliptical
    
    #mars_loc = np.array([(-227.9e9/146.6e9)*AU,0])
    #mars_vel = np.array([0,24070])
    
    # Create body objects
    sun = Body('Sun', 2e30, 'yellow', sun_loc, sun_vel, True)
    earth = Body('Earth', 5.9742e24, 'blue', earth_loc, earth_vel, False)
    #mars = Body('Mars', 6.39e23, 'red', mars_loc, mars_vel)
    
    # Do the actual work
    time, pos_data = solve_system([sun, earth], SCALE, AU)
    animate(time, pos_data)
コード例 #2
0
ファイル: project2.py プロジェクト: gK996/Othello
def drawBoard(b):
    #set up window
    t.setup(600,600)
    t.bgcolor("dark green")
    
    #turtle settings
    t.hideturtle()
    t.speed(0)
    
    num=len(b)
    side=600/num
    xcod=-300
    ycod=-300
    for x in b:
        for y in x:
            if(y> 0):
                drawsquare(xcod,ycod,side,'black')
            if(y< 0):
                drawsquare(xcod,ycod,side,'white')
            if(y==0):
                drawsquare(xcod,ycod,side,'dark green')
            
            xcod=xcod+side
        xcod=-300
        ycod=ycod+side
コード例 #3
0
ファイル: simulator 2D.py プロジェクト: emcangi/Nbody
def main():
    '''
    Main loop which sets the parameters and calls the simulation
    '''  
    
    # Set the mood
    t.bgcolor('black')
    
    # Assumed scale: 100 pixels = 1AU.
    AU = 149.6e9                # 149.6 billion meters is one astronomical unit
    SCALE = 250 / AU                            # 2e-9;  100 px
    
    # Declare positions and velocities for two bodies
    sun_loc = np.array([0,0])
    sun_vel = np.array([0,0])
    
    earth_loc = np.array([-1*AU, 0])
    earth_vel = np.array([0, 35000])              # shows elliptical
    
    #mars_loc = np.array([(-227.9e9/146.6e9)*AU,0])
    #mars_vel = np.array([0,24070])
    
    sun = Body('Sun', 2e30, 'yellow', sun_loc, sun_vel)
    earth = Body('Earth', 5.9742e24, 'blue', earth_loc, earth_vel)
    #mars = Body('Mars', 6.39e23, 'red', mars_loc, mars_vel)
    
    run([sun, earth], SCALE, AU)
コード例 #4
0
ファイル: franklinFraktal.py プロジェクト: pbialas/lsystem
def franklinBegin():
		turtle.screensize(3000, 3000)
		turtle.clearscreen()
		turtle.bgcolor('black')
		franklin = turtle.Turtle(visible = False)
		franklin.color('green', 'green')
		franklin.speed(0)
		return franklin
コード例 #5
0
def init_screen():
    # Delete the turtle's drawings from the screen, re-center the turtle and
    # set variables to the default values
    screen = turtle.Screen()
    screen.setup(width=500, height=500)
    screen.title('Yin Yang')
    turtle.reset()
    turtle.bgcolor('#E8E8F6')
    turtle.hideturtle()
コード例 #6
0
ファイル: demo.py プロジェクト: kvalle/lindenmayer
 def __init__(self, demo, levels):
     turtle.bgcolor('black')
     fun = getattr(self,'demo_'+demo)
     koopa, path = fun(levels) if levels else fun()
     koopa.width(2)
     koopa.color('white')
     koopa.speed(8)
     koopa.draw(path)
     raw_input()
コード例 #7
0
def ready(rad):
    turtle.speed(0)
    turtle.ht()
    turtle.up()
    turtle.goto(0,-rad)
    turtle.down()
    turtle.colormode(1)
    turtle.bgcolor('black')
    turtle.pensize(1.1)
コード例 #8
0
ファイル: turtleTest.py プロジェクト: asweigart/tortuga
    def test_bgcolor(self):
        for c in (spanish_colors):
            tortuga.color_fondo(c)
            tortuga.forward(3)

        for c in (english_colors):
            turtle.bgcolor(c)
            turtle.forward(3)

        self.assert_same()
コード例 #9
0
ファイル: starObj.py プロジェクト: mcgettin/ditOldProgramming
    def  __init__(self,radius=500,mass=15000,name="star",colour="yellow"):
        super().__init__(radius,mass)
        self.turt=turtle.Turtle()
        self.radius=radius
        self.mass=mass
        self.name=name
        self.colour=colour

        turtle.bgcolor('black') #bg color
        self.turt.shape("circle")
        self.turt.shapesize(self.radius,self.radius,1)
        self.turt.color(self.colour)
コード例 #10
0
ファイル: virtual_machine.py プロジェクト: maumruiz/Tortuga
    def background_color(self, quadruple):
        operand1_dir = int(quadruple['operand_1'])
        operand2_dir = int(quadruple['operand_2'])
        operand3_dir = int(quadruple['result'])

        operand1 = self.memory_map.get_value(operand1_dir)
        operand2 = self.memory_map.get_value(operand2_dir)
        operand3 = self.memory_map.get_value(operand3_dir)

        self.log.write(" ****************** Quadruple " + str(self.current_quadruple) + " **********************")
        self.log.write(" * background_color: " + str(operand1) + ' ' + str(operand1) + ' ' + str(operand3))
        turtle.colormode(255)
        turtle.bgcolor(operand1, operand2, operand3)
コード例 #11
0
def tegn_bakgrunn():
    turtle.bgcolor('black')
    turtle.speed(11)
    turtle.pensize(10)
    turtle.penup()
    turtle.setposition(-400, -300)
    turtle.pendown()
    turtle.color('grey')
    turtle.forward(200)
    turtle.color('red')
    turtle.forward(200)
    turtle.color('grey')
    turtle.forward(400)
コード例 #12
0
ファイル: snowflake.py プロジェクト: LindaPulickal/Turtle-Art
def main():
	myTurtle = turtle.Turtle()
	screen = turtle.Screen()
	turtle.bgcolor("lightblue")
	myTurtle.color("white")
	myTurtle.width(10)
	
	for i in range(0,360,30):
		drawStrand(myTurtle,100)
		myTurtle.left(30)
		
	myTurtle.hideturtle()
	screen.exitonclick()	
コード例 #13
0
ファイル: docking.py プロジェクト: johnkershaw/bryn_game
def screen_setup():
    turtle.setup(900, 500, 0,0)
    turtle.title("Navigation system")
    turtle.bgcolor('black')
    con = turtle.Turtle()
    con.penup()
    con.speed(0)
    con.color('white')
    con.hideturtle()
    con.setpos(420, -230)
    con.write('+')
    con.setpos(430, -230)
    con.write('-')
コード例 #14
0
ファイル: 3 body sim RK.py プロジェクト: emcangi/Nbody
def main():
    '''
    Sets the parameters and calls the functions which solve the system and then
    animate it. Planet and sun sizes are not to scale.
    '''

    from math import sqrt

    # Set the mood
    t.bgcolor('black')

    # planet selector. 0 = Mercury, 1 = Venus, ... 7 = Neptune
    planet = 7

    # Initial parameters. a = semimajor axis in AU; e = eccentricity;
    # mass = mass in kg. given in arrays where first item is Mercury and last
    # item is Neptune.
    axis_set = np.array([0.387098, 0.723331, 1.00000011, 1.523662, 5.203363,
                         9.537070, 19.191263, 30.068963]) * AU
    e_set = np.array([0.206, 0.007, 0.017, 0.093, 0.048, 0.056, 0.046, 0.010])
    mass_set = np.array([0.330, 4.87, 5.97, 0.642, 1898, 568, 86.8,
                         102]) * 10**(24)
    names = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn',
             'Uranus', 'Neptune']
    colors = ['red', 'yellow', 'blue', 'red', 'red', 'orange', 'cyan', 'blue']
    pensize = [1/13, 3/13, 4/13, 26/13, 2, 26/13, 20/13, 19/13]

    a = axis_set[planet]
    e = e_set[planet]
    m2 = mass_set[planet]
    m1 = 2e30                                   # Larger body: the sun
    x0 = a * (1 + e)                            # initial position
    v_y0 = sqrt(G * (m1 + m2) * (2/x0 - 1/a))   # initial velocity of sm. body
    color = colors[planet]
    name = names[planet]
    size = pensize[planet]

    # Declare initial positions and velocities for two bodies. Assume more
    # massive body is stationary
    sun_loc = np.array([0, 0])
    sun_vel = np.array([0, 0])
    planet_loc = np.array([x0, 0])
    planet_vel = np.array([0, v_y0])

    # Create body objects
    sun = Body('Sun', m1, 'yellow', sun_loc, sun_vel, 40, True)
    planet = Body(name, m2, color, planet_loc, planet_vel, size, False)

    # Do the actual work
    time, pos_data = solve_system([sun, planet], 24*3600)
    animate(time, pos_data)
コード例 #15
0
def main() :
    screen = turtle.Screen()
    screen.setworldcoordinates(0,0,100,100)
    screen.tracer(1000)
    turtle.bgcolor("yellow")
    pen = turtle.Turtle()
    pen.hideturtle()
    pen.up()
    drawNose(pen)
    drawEyes(pen)
    drawMouth(pen)
    drawEars(pen)
    drawHair(pen)
    screen.exitonclick()
コード例 #16
0
def plot_by_magnitude(picture_size, coordinates_dict, magnitudes_dict):
    length = int(picture_size / 2)
    turtle.bgcolor("black")
    turtle.color("white")
    for number in all_drapers:
        mag = magnitudes_dict[number]
        star_size = round(10.0 / (mag + 2))
        if star_size > 8:
            star_size = 8
        x = coordinates_dict[number][0] * length
        y = coordinates_dict[number][1] * length
        turtle.pu()
        turtle.setpos(x, y)
        draw_square(star_size)
コード例 #17
0
ファイル: rose.py プロジェクト: YinZhongkai/MyProject
def paintInit():
    width = 500
    height = 680
    x = 100
    y = 0
    turtle.setup(width, height, x, y)
    turtle.pensize(3)
    turtle.bgcolor("#FFFE88")
    turtle.penup()
    turtle.left(90)
    turtle.forward(150)
    turtle.left(-90)
    turtle.backward(50)
    turtle.pendown()
コード例 #18
0
ファイル: TurtleDrawLib.py プロジェクト: Tryan18/Python
def graphicsInit(title,bgcolor,s_width,s_height):
    global width
    width = s_width
    global height
    height = s_height
    # hideturtle() same as ht()
    g.hideturtle()
    # SetWindowResolution
    #turtle.setup (width=200, height=200, startx=0, starty=0)
    turtle.setup(width, height, 0, 0)
    g.speed(0)
    g.tracer(1,0)
    #g.goto(0,0);
    turtle.title(title)
    turtle.bgcolor(bgcolor)
コード例 #19
0
ファイル: forest.py プロジェクト: pavanbhat/Python-Labs
def main():
    """
    The main function.
    :pre: (relative) pos (0,0), heading (east)
    :post: (relative) pos (0,0), heading (east)
    :return: None
    """
# the lumber required by the house
    hlumber = 0
    turtle.bgcolor('black')
    turtle.pencolor('white')
    init()

# Number of trees required by the user
    treeNo = int(input('Enter the number of trees '))
    isHouse = input('Is there a house in the forest (y/n)? ')
# generates the house at random locations
    if isHouse == 'y':
        if treeNo >=2 :
            houseNo = random.randint(1, treeNo-1)
        else:
            print('There have to be atleast 2 trees for the house to be printed')
            houseNo = 0
        tlumber = drawTree(treeNo, isHouse, houseNo)
        hlumber = 2 * 50  + 50 * math.sqrt(2) + 50 * math.sqrt(2) + 2 * 50
    else:
        tlumber = drawTree(treeNo, isHouse, 0)

# draws the star 10 pixels higher than the highest tree
    hStar = max(treeHt) + UNIT + 10
    drawstar(hStar)

# Total lumber from the trees and the house
    lumber = hlumber + tlumber
    wallht = lumber/(2 + math.sqrt(2))
    input('Night is done, press enter for day')
    turtle.reset()
    init()
    turtle.bgcolor('white')
    turtle.pencolor('black')
    input('We have ' + str(lumber) + ' units of lumber for the building.')
    input('We will build a house with walls ' + str(wallht) + ' tall.')
    drawHouse(wallht/2)
    drawSpace()
    turtle.left(90)
    turtle.forward(wallht * 2)
    drawSun()
    input('Day is done, house is built, press enter to quit')
コード例 #20
0
def main():
    screen = turtle.Screen()
    screen.title('Yin Yang')
    screen.setup(width=500, height=500)

    # Delete the pen's drawings from the screen, re-center the pen and
    # set variables to the default values
    pen = turtle.Turtle()
    turtle.bgcolor('#E8E8F6')
    pen.reset()
    pen.width(3)

    draw_yin(pen)
    draw_yang(pen)

    pen.hideturtle()
コード例 #21
0
def drawTreeFractal(height,AngularDisp, Length):
    turtle.bgcolor("#191970")
    a = (0,-200)
    Base(a)
    turtle.setheading(90)
    turtle.color("green")
    turtle.fd(1000)
    turtle.bk(2000)
    Base(a)
    star1()
    star2()
    sign()
    makeTree(height, Length,a,0,AngularDisp*2)
    turtle.setheading(180)
    makeTree(3, Length/2.00,a,0,AngularDisp*2)
    turtle.done()
コード例 #22
0
def main():
    # Delete the turtle's drawings from the screen, re-center the turtle and
    # set variables to the default values
    screen = turtle.Screen()
    screen.setup(width=500, height=500)
    screen.title('Yin Yang')

    turtle.reset()
    turtle.bgcolor('#E8E8F6')
    turtle.hideturtle()

    yin_thread = Thread(target=draw_yin)
    yang_thread = Thread(target=draw_yang)

    yin_thread.start()
    yang_thread.start()
コード例 #23
0
ファイル: hangman.py プロジェクト: BCasaleiro/Hangman
def main():
	word=wordlist().strip('\n').lower()
	print(word)
	spaces(word)
	out=''
	for i in range(len(word)):
		out+='_'
	while out != word and stage[0]<=4:
		print(out)
		out=play(word, out)
	if stage[0] > 4:
		print('DEAD!')
		turtle.bgcolor('red')
		turtle.exitonclick()
	else:
		print('CONGRATS!!!! The word was ' + word + '!')
		turtle.exitonclick()
コード例 #24
0
ファイル: Fractal.py プロジェクト: wpank/Python
def drawLevy(n):
    'draws nth Levy curve using instructions obtained from function levy()'    
    directions = levy(n)
    t = Turtle()
    bgcolor('black')
    t.pencolor('yellow')
    t.penup()
    t.goto(-300,0)
    t.pendown()
    t.pensize(2)
    for move in directions:
        if move == 'F':
            t.fd(200/math.sqrt(2)**n)
        if move == 'L':
            t.lt(45)
        if move == 'R':
            t.rt(90)
コード例 #25
0
ファイル: hanoi.py プロジェクト: rsiva911/tower-of-hanoi
 def play(self,num):
     turtle.bgcolor("black")
     turtle.setpos(0,250)
     turtle.color("purple")
     drawtower()
     self.createtower(num)
     drawstack(self.t1,self.t2,self.t3)
     flag=0
     moves=1
     m=[]
     while flag==0:
        #turtle.write("MOVE:   ","center",("Arial",30,"normal"))
         print("\n")
         s=input("ENTER s TO SEE SOLUTION: ")
         if s=='s': self.solve(num);break;
         else:
             m1=input("ENTER MOVE FROM: ")
             m2=input("ENTER MOVE TO: ")
             if m1=='a' and self.t1.is_empty(): print("NO DISKS IN TOWER"); continue
             elif m1=='b' and self.t2.is_empty(): print("NO DISKS IN TOWER"); continue
             elif m1=='c' and self.t3.is_empty(): print("NO DISKS IN TOWER"); continue
             chk=self.move(m1,m2)
             if chk:
                 print("cannot place bigger disk on top of smaller disk")
                 turtle.reset()
                 turtle.write("TOWER OF HANOI",True,"center",("Arial",40,"normal"))
                 drawtower()
                 drawstack(self.t1,self.t2,self.t3)
                 continue
             else:
                 if self.check(num)==0:
                     turtle.reset()
                     turtle.write("TOWER OF HANOI",True,"center",("Arial",40,"normal"))
                     drawtower()
                     drawstack(self.t1,self.t2,self.t3)
                     flag=1
                     break
                 else:
                     turtle.reset()
                     turtle.write("TOWER OF HANOI",True,"center",("Arial",40,"normal"))
                     drawtower()
                     drawstack(self.t1,self.t2,self.t3)
             moves=moves+1
     if flag==1:
         print("YOU SOLVED IT IN ",moves," MOVES.")
コード例 #26
0
ファイル: lindenmayer.py プロジェクト: jonnor/projects
def draw(sequence, actions):
    import Tkinter as tk
    import turtle
    turtle.reset()
    turtle.speed(0)
    turtle.tracer(1, 0)
    turtle.bgcolor('black')
    turtle.color('white')

    def noop(turtle):
        pass

    for s in sequence:
        for c in s:
            action = getattr(actions, c, noop)
            action(turtle)

    turtle.mainloop()
コード例 #27
0
ファイル: colorspiral.py プロジェクト: SYYSEDIT/syys
def cspiral(sides=6, size=360, x=0, y=0):
    """Draws a colorful spiral on a black background.
    Arguments:
    sides -- the number of sides in the spiral (default 6)
    size -- the length of the last side (default 360)
    x, y -- the location of the spiral, from the center of the screen
    """
    t=turtle.Pen()
    t.speed(0)
    t.penup()
    t.setpos(x,y)
    t.pendown()
    turtle.bgcolor("black")
    colors=["red", "yellow", "blue", "orange", "green", "purple"]
    for n in range(size):
        t.pencolor(colors[n%sides])
        t.forward(n * 3/sides + n)
        t.left(360/sides + 1)
        t.width(n*sides/100)
コード例 #28
0
ファイル: oldVer.py プロジェクト: mcgettin/ditOldProgramming
def main():

    t=turtle.Turtle()

    G=-9.8
    Time=0.2

    t.ht() #hide arrow
    t.pos() #gives position
    t.speed(100) # how fast it writes
    turtle.bgcolor('white') #bg color

    '''
    t.up()
    t.right(90)
    t.forward(300)
    t.down()
    t.left(90)
    '''
    t.forward(400)
    t.backward(800)

    #param:- turtle - dist_X - dist_Y - velocity_X - velocity_Y - stickiness/friction
    b1=Ball(t,-200,80,10,40,8,1.25)
    i=0
    while not (b1.dY < 1 and b1.vY < 1 and b1.vX < 1):
        i+=1
        print("\n\n\n-------- {} ---------\n\n\n".format(i+1))
        b1.move(t,G,Time)
        if(b1.vY<=0):
            G*=-1
            b1.vY=0
            #t.dot(b1.radius,b1.colour)
        if(b1.dY <=0):
            G*=-1
            b1.dY=0
            t.goto(b1.dX,b1.dY)
            b1.vY/=b1.sticky
            b1.vX/=b1.sticky
            #t.dot(b1.radius,b1.colour)
        if(b1.dX >= 80 or b1.dX <= -80): b1.foward=not b1.forward

    t.dot(b1.radius,b1.colour)
コード例 #29
0
ファイル: main.py プロジェクト: prachi1210/hangman-python
def main():
    word=get_random_word(r"wordlist.txt").strip('\n').lower()
    print(word)
    #print(len(word))
    print("We have a chosen a "+str(len(word))+" lettered word")
    spaces(word)
    out=' '
    for i in range(len(word)):
        out+='_'
    while out != word and stage[0] <=4:
        print(out)
        out=play(word, out)
    if stage[0] > 4:
        print('Oops. You died')
        turtle.bgcolor('red')
        turtle.exitonclick()
    else:
        print('Congratulations. You guessed correctly ' + word + '!')
        turtle.exitonclick()
コード例 #30
0
ファイル: hanoi.py プロジェクト: rsiva911/tower-of-hanoi
def drawtower():
    turtle.tracer(3)
    turtle.setpos(0,250)
    turtle.color("purple")
    turtle.write("TOWER OF HANOI",True,"center",("Arial",40,"normal"))
    turtle.bgcolor("black")
    turtle.pensize(4)
    turtle.left(90)
    turtle.pendown()
    x=-150
    y=-150
    i=0
    for i in range(3):
        turtle.pencolor("black")
        turtle.setpos(x,y)
        turtle.pencolor("brown")
        turtle.forward(300)
        x=x+200
    turtle.penup()
    turtle.setpos(50,-225)
    turtle.write("A           B             C",True,"center",("Arial",40,"normal"))
コード例 #31
0
# 스크립트 모드입니다

import turtle
t1 = turtle.Turtle('triangle')
t2 = turtle.Turtle('turtle')

colors = ["red", "blue", "green"]
turtle.bgcolor("yellow")
t1.speed(10)
t1.width(5)
length1 = 10

t2.speed(8)
t2.width(5)
t2.pencolor('pink')
length2 = 10

while length1 < 600:
    t1.fd(length1)
    t1.pencolor(colors[length1 % 3])
    t1.right(89)
    length1 += 3  #length1 = length1 + 3
while length2 < 600:
    t2.fd(length2)
    t2.pencolor('blue')
    t2.left(88)
    length2 += 4  #length2 = length2 + 4

input()
コード例 #32
0
import turtle

turtle.colormode(255)
from myfunctionfile import *

bob = turtle.Turtle()
turtle.bgcolor(255, 205, 148)
bob.width(3)
bob.speed(0)
c = 200, 0, 0
c2 = 175, 0, 0
c3 = 150, 0, 0
c4 = 255, 255, 255
c5 = 250, 0, 0
circle(bob, 100, c4)
circle(bob, 50, c3)
circle(bob, 30, c2)
jump(bob, 2, 2)
circle(bob, 10, c)
jump(bob, -50, 50)
bob.color(c5)
bob.backward(20)
bob.left(93)
bob.forward(24)
bob.left(63)
bob.forward(33)
bob.backward(33)
jump(bob, 0, 150)
bob.right(90)
bob.forward(50)
bob.backward(50)
コード例 #33
0
import turtle

t = turtle.Pen()
turtle.bgcolor('gray')
sides = eval(input('Enter a number of sides between 2 and 6: '))
colors = ['red', 'yellow', 'blue', 'green', 'black', 'purple']
for x in range(360):
    t.pencolor(colors[x % sides])
    t.forward(x * 3 / sides + x)
    t.left(360 / sides + 1 + 90)
    t.width(x * sides / 200)
コード例 #34
0
def main():
    p.setup(800, 600, 0, 0)
    p.bgcolor("black")
    snow(30)
    ground(30)
    p.mainloop()
コード例 #35
0
#used functions that include functions
#Brianna Odell and Nicole Ferris
#project

import turtle
from functionfile2 import *
bob = turtle.Turtle()
bob.pensize(3)
bob.speed(11)
turtle.bgcolor('medium aquamarine')

for times in range(50):
    cool(bob, 55 - times * 5)
    bob.forward(times * 6)
    bob.right(70)
コード例 #36
0
ファイル: main.py プロジェクト: PISANKINA/pr4
from ufo import *
import turtle as tr
import random

tr.tracer(0)
tr.hideturtle()
tr.bgcolor('blue')

colors = ['green', 'blue', 'pink', 'orange', 'red', 'black', 'brown', 'yellow']
lst_ufo = []
tr.showturtle()
response = tr.numinput('Ответ', 'Введите желаемое кол-во тарелок:')
if response == None:
    pass
else:
    for i in range(int(response)):
        lst_ufo.append(
            Ufo('Пришелец-' + str(i), random.randint(-600, 600),
                random.randint(-600, 600), random.randint(30, 300),
                colors[random.randint(0, 7)], random.randint(3, 10),
                random.randint(2, 8)))

while True:
    for i in range(len(lst_ufo)):
        lst_ufo[i].show()
        lst_ufo[i].move()
    tr.update()
    tr.clear()

    tr.listen()
コード例 #37
0
# Python program to draw Spiral Helix pattern using Turtle programming.
import turtle

window = turtle.Screen()
turtle.speed(2)
turtle.bgcolor('Black')

for i in range(120):
    turtle.pencolor('Blue')
    turtle.circle(5*i)
    turtle.circle(-5*i)
    turtle.left(i)

turtle.exitonclick()
コード例 #38
0
ファイル: Main.py プロジェクト: AsheepDaBot/Tachyphylaxis
def how1(x, y):
    game1.clear()
    game2.clear()
    bgtrtl.clear()
    game1.hideturtle()
    game2.hideturtle()

    trtl.bgcolor("springgreen")
    sb.write(0, style)

    definitions = []
    answers = []

    writer = trtl.Turtle()
    writer.penup()
    writer.hideturtle()
    writer.speed(0)

    box1 = trtl.Turtle()
    box1.penup()
    box1.shape("square")
    box1.fillcolor("mintcream")
    box1.shapesize(5)
    box1.goto(-200, -100)

    box2 = trtl.Turtle()
    box2.penup()
    box2.shape("square")
    box2.fillcolor("mintcream")
    box2.shapesize(5)
    box2.goto(-73, -100)

    box3 = trtl.Turtle()
    box3.penup()
    box3.shape("square")
    box3.fillcolor("mintcream")
    box3.shapesize(5)
    box3.goto(73, -100)

    box4 = trtl.Turtle()
    box4.penup()
    box4.shape("square")
    box4.fillcolor("mintcream")
    box4.shapesize(5)
    box4.goto(200, -100)

    with open('example.txt', 'r') as fin:
        options = int(fin.readline())
        for i in range(options):
            x = fin.readline()
            definitions.append(x)

        for j in range(options):
            x = fin.readline()
            answers.append(x)

    for q in answers:

        not_clicked = True
        counter = 0
        options = [definitions[answers.index(q)]]

        for i in range(3):

            x = definitions[random.randint(0, len(answers) - 1)]
            while x in options:
                x = definitions[random.randint(0, len(answers) - 1)]

            options.append(x)

        random.shuffle(options)
        correct_option = options.index(definitions[answers.index(q)])

        writer.clear()
        writer.goto(-110, 0)
        writer.write("What best represents " + q, font=style)
        state_left = win32api.GetKeyState(0x01)

        while counter < 5 and not_clicked:

            writer.goto(-225, -150)
            writer.write(options[0], font=style)
            writer.goto(-100, -150)
            writer.write(options[1], font=style)
            writer.goto(65, -150)
            writer.write(options[2], font=style)
            writer.goto(180, -150)
            writer.write(options[3], font=style)

            time.sleep(2)
            counter += 0
            a = win32api.GetKeyState(0x01)

            if a != state_left:
                state_left = a
                not_clicked = False

            if correct_option == 0:
                box1.onclick(correct_chosen)
                if not not_clicked:
                    box1.fillcolor("green")
                    box4.fillcolor("red")
                    box2.fillcolor("red")
                    box3.fillcolor("red")

            elif correct_option == 1:
                box2.onclick(correct_chosen)
                if not not_clicked:
                    box2.fillcolor("green")
                    box1.fillcolor("red")
                    box4.fillcolor("red")
                    box3.fillcolor("red")

            elif correct_option == 2:
                box3.onclick(correct_chosen)
                if not not_clicked:
                    box3.fillcolor("green")
                    box1.fillcolor("red")
                    box2.fillcolor("red")
                    box4.fillcolor("red")

            elif correct_option == 3:
                box4.onclick(correct_chosen)
                if not not_clicked:
                    box4.fillcolor("green")
                    box1.fillcolor("red")
                    box2.fillcolor("red")
                    box3.fillcolor("red")

        time.sleep(1)
        box1.fillcolor("mintcream")
        box2.fillcolor("mintcream")
        box3.fillcolor("mintcream")
        box4.fillcolor("mintcream")

    writer.clear()
    box1.hideturtle()
    box2.hideturtle()
    box3.hideturtle()
    box4.hideturtle()

    writer.goto(-200, 50)
    writer.write("Congratulations!", font=('Times New Roman', 50, 'italic'))
    writer.goto(-90, 0)
    writer.write("You got " + str(score) + " out of " + str(len(definitions)),
                 font=('Times New Roman', 30, 'italic'))
コード例 #39
0
#import turtle

#t = turtle.Pen()

#turtle.bgcolor("black")

#colors = ["red", "yellow", "blue", "green"]

#for x in range(100):
#    t.pencolor(colors[x%4])
#    t.circle(x)
#    t.left(91)

import turtle
t = turtle.Pen()
turtle.bgcolor("white")
colors = ["red", "yellow", "gray", "orange"]
for x in range(100):
    t.pencolor(colors[x % 4])
    t.forward(x)
    t.left(91)
コード例 #40
0
ファイル: start.py プロジェクト: Barzarrhey/Crawfish
    def draw(self):
        turtle.setup(666, 400)
        turtle.bgcolor("black")
        # turtle.bgpic("logo.JPG")
        turtle.hideturtle()
        turtle.speed(10)
        turtle.penup()
        turtle.goto(-200, 50)
        turtle.pendown()
        turtle.pensize(self.pythonSize)
        turtle.seth(-40)
        for i in range(self.len):
            turtle.color(self.colors[i])
            turtle.circle(self.rad, self.angle)
            turtle.circle(-self.rad, self.angle)

        turtle.color("purple")
        turtle.circle(self.rad, self.angle / 2)
        turtle.fd(self.rad)
        turtle.circle(self.neckRad + 1, 180)
        turtle.fd(self.rad * 2 / 3)
        # turtle.write(s, font=(“font-name”, font_size, ”font_type”))
        turtle.penup()
        turtle.goto(-60, -60)
        turtle.color("pink")
        turtle.pendown()
        turtle.write("让我们吃着小龙虾", align="left", font=("Courier", 20, "bold"))
        time.sleep(1)
        turtle.penup()
        turtle.goto(-60, -80)
        turtle.pendown()
        turtle.write("看着屏幕", align="left", font=("Courier", 20, "bold"))
        time.sleep(1)
        turtle.penup()
        turtle.goto(-60, -100)
        turtle.pendown()
        turtle.write("享受这大千世界与开源不求回报的礼物",
                     align="left",
                     font=("Courier", 20, "bold"))
        time.sleep(1)
        turtle.penup()
        turtle.goto(-60, -120)
        turtle.pendown()
        turtle.write("Forever don't forget the day,",
                     align="left",
                     font=("Courier", 20, "bold"))
        time.sleep(1.5)
        turtle.penup()
        turtle.goto(-60, -140)
        turtle.pendown()
        turtle.write("that someone told you excitedly!",
                     align="left",
                     font=("Courier", 20, "bold"))
        time.sleep(1.5)
        turtle.penup()
        turtle.goto(-60, -160)
        turtle.pendown()
        turtle.write("we needn't rewhell!",
                     align="left",
                     font=("Courier", 20, "bold"))
        time.sleep(2)
コード例 #41
0
import turtle
turtle.bgcolor("black")
turtle.pensize(2)
turtle.speed(0)

for i in range(6):
    for colours in [
            'red', 'magenta', 'blue', 'cyan', 'green', 'yellow', 'white'
    ]:
        turtle.color(colours)
        turtle.circle(100)
        turtle.left(10)
turtle.hideturtle()
コード例 #42
0
import turtle, random, time

turtle.title('The Turtle Experiment')
turtle.shape('turtle')
turtle.color('white')
turtle.fillcolor('white')
turtle.bgcolor('skyblue')
turtle.pensize(2)
turtle.speed(100)
turtle.penup()
cloudDone = False


def semiCircle(size):
    turtle.pendown()
    for i in range(0, 20):
        turtle.forward(size)
        turtle.left(9)
    turtle.left(180)


def adjustTurn():
    heading = turtle.heading()
    randTurn = random.randint(1, 10)
    if heading >= 50 and heading <= 140:
        turtle.left(randTurn * 2)
    if heading > 140 and heading <= 220:
        turtle.left(randTurn * 10)
    if heading > 220 and heading <= 270:
        turtle.left(randTurn * 2)
    if heading > 270 and heading < 50:
コード例 #43
0
        x = r.randint(-230, 230)
        y = r.randint(-230, 230)
        ts.goto(x, y)

    time = int(i.time())


def message(m1):
    t.clear()
    t.write(m1, False, "center", ("", 20))
    t.goto(0, 200)
    t.home()


t.setup(500, 500)
t.bgcolor("black")
t.shape()
t.color("cyan")

ts = t.Turtle()
ts.shape("circle")
ts.up()
ts.goto(-100, 150)
ts.color("green")

t.onkeypress(up, "Up")
t.onkeypress(down, "Down")
t.onkeypress(right, "Right")
t.onkeypress(left, "Left")
t.onkeypress(space, "space")
t.listen()
コード例 #44
0
def move_snake():
    my_pos = snake.pos()
    x_pos = my_pos[0]
    y_pos = my_pos[1]

    if direction == RIGHT:
        snake.goto(x_pos + SQUARE_SIZE, y_pos)
        print("You moved right!")
    elif direction == LEFT:
        snake.goto(x_pos - SQUARE_SIZE, y_pos)
        print("You moved left!")

    #4. Write the conditions for UP and DOWN on your own
    ##### YOUR CODE HERE
    elif direction == UP:
        snake.goto(x_pos, y_pos + SQUARE_SIZE)
        print("You moved up!")

    elif direction == DOWN:
        snake.goto(x_pos, y_pos - SQUARE_SIZE)
        print("You moved down")

    #Stamp new element and append new stamp in list
    #Remember: The snake position changed - update my_pos()

    my_pos = snake.pos()
    pos_list.append(my_pos)
    new_stamp = snake.stamp()
    stamp_list.append(new_stamp)
    ######## SPECIAL PLACE - Remember it for Part 5
    #pop zeroth element in pos_list to get rid of last the last
    #piece of the tail
    global food_stamps, food_pos, score
    if snake.pos() in food_pos:
        food_ind = food_pos.index(snake.pos())  #What does this do?
        food.clearstamp(food_stamps[food_ind])  #Remove eaten food#stamp
        print(score)
        score += 1
        scorecount.clear()
        scorecount.color('black')
        scorecount.hideturtle()
        scorecount.penup()
        scorecount.goto(0, -350)
        scorecount.write(score, align="center", font=('Arial', 50))
        turtle.bgcolor(bg_color)
        turtle.penup()
        turtle.goto(0, 300)
        turtle.write("SNAKE GAME",
                     align="center",
                     font=('Arial', 50, "normal"))
        turtle.penup()
        turtle.goto(-400, -250)
        turtle.pensize(5)
        turtle.pendown()
        turtle.goto(-400, 250)
        turtle.goto(400, 250)
        turtle.goto(400, -250)
        turtle.goto(-400, -250)
        turtle.penup()
        turtle.goto(0, 0)

        if score == 5:
            snake.fillcolor("yellow")
        elif score == 10:
            snake.fillcolor("blue")
        elif score == 15:
            snake.fillcolor("red")
        elif score == 20:
            snake.fillcolor("white")
        elif score == 25:
            snake.fillcolor("purple")
        elif score == 30:
            snake.fillcolor("green")
        elif score == 35:
            snake.shape("trash.gif")
        elif score == 40:
            snake.shape("diamond.gif")
        elif score == 45:
            snake.shape("glove.gif")

        food_pos.pop(food_ind)  #Remove eaten food position
        food_stamps.pop(food_ind)  #Remove eaten food stamp
        print("You have eaten the food!")
        while len(food_stamps) < 4:
            make_food()

    else:
        old_stamp = stamp_list.pop(0)
        snake.clearstamp(old_stamp)
        pos_list.pop(0)

    if pos_list[-1] in pos_list[:-1]:
        print('you ate yourself!')
        scorecount.clear()
        gameover.write('GAME OVER', font=('Arial', 95), align="center")
        time.sleep(3)
        quit()

    #HINT: This if statement may be useful for Part 8

    #Don't change the rest of the code in move_snake() function:
    #If you have included the timer so the snake moves
    #automatically, the function should finish as before with a
    #call to ontimer()

    UP_EDGE = 250
    DOWN_EDGE = -250
    RIGHT_EDGE = 400
    LEFT_EDGE = -400

    new_pos = snake.pos()
    new_x_pos = new_pos[0]
    new_y_pos = new_pos[1]

    if new_x_pos >= RIGHT_EDGE:
        print("you tuched the edge GAME OVER")
        scorecount.clear()
        gameover.write('GAME OVER', font=('Arial', 95), align="center")
        time.sleep(3)
        quit()
    if new_x_pos <= LEFT_EDGE:
        print("you tuched the edge GAME OVER")
        scorecout.clear()
        gameover.write('GAME OVER', font=('Arial', 95), align="center")
        time.sleep(3)
        quit()
    if new_y_pos >= UP_EDGE:
        print("you tuched the edge GAME OVER")
        scorecount.clear()
        gameover.write('GAME OVER', font=('Arial', 95), align="center")
        time.sleep(3)
        quit()
    if new_y_pos <= DOWN_EDGE:
        print("you tuched the edge GAME OVER")
        scorecount.clear()
        gameover.write('GAME OVER', font=('Arial', 95), align="center")
        time.sleep(3)
        quit()

    turtle.ontimer(move_snake, TIME_STEP)
コード例 #45
0
# ColorfulRosettes.py
import turtle
t=turtle.Pen()
turtle.bgcolor('black')
t.speed(0)
t.width(3)
# Ask the user for the number of circles in their rosette, default to 6
number_of_circles = int(turtle.numinput("Number of circles",
                                        "How many circles in your rosette?", 6))
for x in range(number_of_circles):
    t.pencolor('red')
    t.circle(100)
    t.pencolor('yellow')
    t.circle(75)
    t.pencolor('green')
    t.circle(50)
    t.pencolor('blue')
    t.circle(25)
    t.pencolor('purple')
    t.circle(15)
    t.left(360/number_of_circles)

コード例 #46
0
import turtle as tur

tur.title('Am I not turtley enough for the Turtle Club?')

tur.setup(width=600, height=500)
tur.reset()
tur.hideturtle()
tur.speed(10)

tur.bgcolor('black')

c = 0
x = 0

colors = [
    # reddish colors
    (1.00, 0.00, 0.00),
    (1.00, 0.03, 0.00),
    (1.00, 0.05, 0.00),
    (1.00, 0.07, 0.00),
    (1.00, 0.10, 0.00),
    (1.00, 0.12, 0.00),
    (1.00, 0.15, 0.00),
    (1.00, 0.17, 0.00),
    (1.00, 0.20, 0.00),
    (1.00, 0.23, 0.00),
    (1.00, 0.25, 0.00),
    (1.00, 0.28, 0.00),
    (1.00, 0.30, 0.00),
    (1.00, 0.33, 0.00),
    (1.00, 0.35, 0.00),
コード例 #47
0
import turtle

x = 0
y = 0
a = int(input('довжина сторони:'))

turtle.bgcolor("blue")
turtle.speed(0)
turtle.pencolor('yellow')


def sofi(side, xpos, ypos):
    print(turtle.position())
    turtle.forward(side)
    turtle.left(90)
    turtle.forward(side)
    turtle.left(90)
    turtle.forward(side)
    turtle.left(90)
    turtle.forward(side)
    turtle.left(90)
    turtle.setposition(xpos, ypos)


while a <= 300:
    a = a + 10
    x = x - 5
    y = y - 5
    sofi(a, x, y)
    print(a)
コード例 #48
0
ファイル: 4-color.py プロジェクト: moxwel/basics
import turtle

#Para cambiar el color del lapiz, hay que usar la funcion color(). El primer argumento es el color del lapiz, el segundo argumento es el color de relleno, lo veremos mas adelante. Si solo hay un argumento, ese color se establecera como color de lapiz y de relleno tambien.
turtle.forward(100)
turtle.left(90)

#Se puede usar el nombre del color como una cadena.
turtle.color("red")
turtle.forward(100)
turtle.left(90)

turtle.color("blue")
turtle.forward(100)
turtle.left(90)

turtle.color("green")
turtle.forward(100)
turtle.left(90)

#Con la funcion bgcolor() podemos cambiar el color del fondo.
turtle.bgcolor("gray")

while True:
    turtle.forward(0)
コード例 #49
0
ファイル: Main.py プロジェクト: AsheepDaBot/Tachyphylaxis
game1.shape('square')
game2.shape('square')

game1.fillcolor("cyan")
game2.fillcolor("cyan")

game1.shapesize(7)
game2.shapesize(7)

game1.penup()
game2.penup()

game1.goto(0, 20)
game2.goto(0, -140)

trtl.bgcolor('#00ffdf')

count = 0

bgtrtl.speed(0)
bgtrtl.hideturtle()
bgtrtl.penup()
bgtrtl.goto(-160, 100)
bgtrtl.write('Tachyphylaxis', font=("Arial", 40, "normal"))

bgtrtl.color('#328CA8')
bgtrtl.penup()
bgtrtl.setpos(270, 410)
bgtrtl.right(45)
bgtrtl.pendown()
bgtrtl.forward(300)
コード例 #50
0
ファイル: day03-exam04.py プロジェクト: KyungMin-tech/myPy
    if playing:
        t.ontimer(play, 100)


def message(m1, m2):  # 게임을 시작하기전 처음 문구설정 함수
    t.clear()
    t.goto(0, 100)
    t.write(m1, False, "center", ("", 20))
    t.goto(0, -100)
    t.write(m2, False, "center", ("", 15))
    t.home()


t.title("Turtle Run Game")  # 타이틀 이름 설정
t.setup(500, 500)  # 너비 500 높이 500
t.bgcolor("orange")  # 배경은 주황색
t.shape("turtle")
t.speed(10)  # 내 거북이의 속도는 10
t.up()  # 내 거북이의 꼬리를 올려서 자취를 안남게 설정한다
t.color("white")  # 내거북이의 색은 하얀색

t.onkeypress(turn_right, "Right")  # 키보드 오른쪽을 누르면 방향전환
t.onkeypress(turn_up, "Up")  # 키보드 위쪽을 누르면 방향 전환
t.onkeypress(turn_left, "Left")  # 키보드 왼쪽을 누르면 방향전환
t.onkeypress(turn_down, "Down")  # 키보드 아래쪽으로 누르면 방향전환
t.onkeypress(start, "space")  # 키보드 스페이스바를 누르면 게임시작

t.listen()  # 키보드를 눌렀을때 그것을 듣고 수행

message("Turtle Run Game Start", "[Space]")  #설정한 문구를 나타낸다
コード例 #51
0
import turtle as t

#선 색상에 사용할 이름 리스트
colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow']
t.setup(500, 400)  #초기 원도의 크기 조정
t.bgcolor('black')  #바탕색 변경

for i in range(180):
    t.pencolor(colors[i % len(colors)])
    t.width(i / 100 + 1)
    t.forward(i)
    t.left(59)
コード例 #52
0
import turtle
import random
import time  #We'll need this later in the lab
print('green, blue, yellow, pink, red, purple, black, white, brown orange')
bg_color = input("type yur chosen your backround color here ======> ")

score = 0
scorecount = turtle.clone()
scorecount.hideturtle()
gameover = turtle.clone()
gameover.penup()
gameover.goto(0, -400)
gameover.color('black')
gameover.hideturtle()

turtle.bgcolor(bg_color)
turtle.penup()
turtle.goto(0, 300)
turtle.write("SNAKE GAME", align="center", font=('Arial', 50, "normal"))
turtle.penup()
turtle.goto(-400, -250)
turtle.pensize(5)
turtle.pendown()
turtle.goto(-400, 250)
turtle.goto(400, 250)
turtle.goto(400, -250)
turtle.goto(-400, -250)
turtle.penup()
turtle.goto(0, 0)
turtle.tracer(1, 0)  #This helps the turtle move more smoothly
コード例 #53
0
import turtle as t
import time as ti
from itertools import cycle

colors = cycle(['green', 'blue', 'purple', 'red', 'orange', 'yellow', 'pink'])


def circle(size, angle, forw, shape):
    t.pencolor(next(colors))
    next_shape = " "
    if shape == 'circle':
        t.circle(size)
        next_shape = 'square'
    elif shape == 'square':
        for square in range(4):
            t.forward(size * 2)
            t.left(90)
        next_shape = 'circle'
    t.right(angle)
    t.forward(forw)
    circle(size + 5, angle + 1, forw + 2, next_shape)


t.bgcolor('black')
t.speed('fast')
t.pensize(4)
circle(30, 0, 1, 'circle')

t.hideturtle()
ti.sleep(3)
コード例 #54
0
def jog1():
    #Turtle race
    #EQM - Games
    #Eduardo Q Marques
    #29/03/2019

    #Janela
    window = turtle.Screen()
    window.title("Turtle Race")
    turtle.bgcolor("forestgreen")
    turtle.color("white")
    turtle.speed(0)
    turtle.penup()
    turtle.setpos(-140, 200)
    turtle.write("Turtle Race", font=("Arial", 30, "bold"))
    turtle.penup()

    #DIRT
    turtle.setpos(-400, -180)
    turtle.color("chocolate")
    turtle.begin_fill()
    turtle.pendown()
    turtle.forward(800)
    turtle.right(90)
    turtle.forward(300)
    turtle.right(90)
    turtle.forward(800)
    turtle.right(90)
    turtle.forward(300)
    turtle.end_fill()

    #Final line
    stamp_size = 20
    square_size = 15
    finish_line = 200

    turtle.color("black")
    turtle.shape("square")
    turtle.shapesize(square_size / stamp_size)
    turtle.penup()

    for i in range(10):
        turtle.setpos(finish_line, (150 - (i * square_size * 2)))
        turtle.stamp()

    for j in range(10):
        turtle.setpos(finish_line + square_size,
                      ((150 - square_size) - (j * square_size * 2)))
        turtle.hideturtle()

    #Jabuti 1
    turtle1 = Turtle()
    turtle1.speed(0)
    turtle1.color("black")
    turtle1.shape("turtle")
    turtle1.penup()
    turtle1.goto(-250, 100)
    turtle1.pendown()

    #Jabuti 2
    turtle2 = Turtle()
    turtle2.speed(0)
    turtle2.color("cyan")
    turtle2.shape("turtle")
    turtle2.penup()
    turtle2.goto(-250, 50)
    turtle2.pendown()

    #Jabuti 3
    turtle3 = Turtle()
    turtle3.speed(0)
    turtle3.color("magenta")
    turtle3.shape("turtle")
    turtle3.penup()
    turtle3.goto(-250, 0)
    turtle3.pendown()

    #Jabuti 4
    turtle4 = Turtle()
    turtle4.speed(0)
    turtle4.color("yellow")
    turtle4.shape("turtle")
    turtle4.penup()
    turtle4.goto(-250, -50)
    turtle4.pendown()

    #Jabuti 5
    turtle5 = Turtle()
    turtle5.speed(0)
    turtle5.color("white")
    turtle5.shape("turtle")
    turtle5.penup()
    turtle5.goto(-250, -100)
    turtle5.pendown()

    time.sleep(2)  #pause in seconds before race

    #Move the jabutis
    for i in range(145):
        turtle1.forward(randint(1, 5))
        turtle2.forward(randint(1, 5))
        turtle3.forward(randint(1, 5))
        turtle4.forward(randint(1, 5))
        turtle5.forward(randint(1, 5))

    turtle.exitonclick()
コード例 #55
0
# # 8.查找错误
# ## errors.py

import turtle
turtle.bgcolor('black') # 改变画布背景颜色为黑色,不要修改这句话

melinda.color("gray")
melinda = turtle.Turtle()
melinda.forward(100)
melinda.left(120)
melinda.forward(100)
melinda.left(12/0)
melinda.forward(100)
コード例 #56
0
import turtle as t
import random as rd

t.bgcolor('blue')

Snake = t.Turtle()
Snake.shape('square')
Snake.speed(0)
Snake.penup()
Snake.hideturtle()

leaf = t.Turtle()
leaf_shape = ((0,0),(14,2),(18,6),(20,20),(6,18),(2,14))
t.register_shape('leaf',leaf_shape)
leaf.shape('leaf')
leaf.color('red')
leaf.penup()
leaf.hideturtle()
leaf.speed()

game_started = False
text_turtle = t.Turtle()
text_turtle.write('Press SPACE to start',align='center',font=('Arial',16,'bold'))
text_turtle.hideturtle()

score_turtle = t.Turtle()
score_turtle.hideturtle()
score_turtle.speed(0)

def outside_window():
    left_wall = -t.window_width()/2
コード例 #57
0
import turtle
import random

turtle.bgcolor("White")
player = turtle.clone()
player.penup()
turtle.setup(width=1900, height=1000, startx=0, starty=0)

turtle.tracer(3)
turtle.penup()

border = turtle.clone()
border.color('green')
border.goto(-900, 450)
border.pendown()
border.goto(900, 450)
border.goto(900, -450)
border.goto(-900, -450)
border.goto(-900, 450)

turtle.tracer(1, 0)

SIZE_X = 1800
SIZE_Y = 900
turtle.setup(SIZE_X + 20, SIZE_Y + 20)

turtle.penup()

SQUARE_SIZE = 20
START_LENGTH = 1
food_time = []
コード例 #58
0
def initialization():
    t.setup(1280, 720)
    t.bgcolor("black")
    t.speed(0)
    t.pensize(1)
コード例 #59
0
ファイル: Love.py プロジェクト: Satyam-kumar7079/hello-world
import turtle 

turtle.speed(4)
turtle.bgcolor('green2')
turtle.pensize(4)

def func():
    for i in range (200):
        turtle.right(1)
        turtle.forward(1)

turtle.color('grey', 'red')
turtle.begin_fill()

turtle.left(121)
turtle.forward(120)

func()
turtle.left(121)

func()
turtle.forward(120)
turtle.end_fill()
turtle.hideturtle()

turtle.done()
コード例 #60
0
import turtle

turtle.speed(25)
turtle.bgcolor("Black")
turtle.pencolor("Red")
#colors("white", "red", "orange", "blue")
#turtle.pencolor(colors[x % 4])


for x in range(720):
    turtle.forward(x)
    turtle.right(250)
    
turtle.done()