コード例 #1
0
ファイル: Zadanie_4.py プロジェクト: ujanlabs/miniLogia_Py
def naGoreWiezy(bokProst1, bokTroj):
    turtle.pu()
    turtle.fd(bokProst1)
    turtle.rt(30)
    turtle.fd(bokTroj)
    turtle.lt(30)
    turtle.pd()
コード例 #2
0
ファイル: neural2.py プロジェクト: glutzic/bob
	def doDraw(self, turtle):
		turtle.pu()
		turtle.setpos(self.x, self.y)
		turtle.begin_fill()
		turtle.circle(self.radius)
		turtle.end_fill()
		return
コード例 #3
0
ファイル: dina.py プロジェクト: dina16-meet/MEET-YL1
def stam(x,y):
    turtle.begin_fill()
    turtle.pu()
    turtle.goto(x,y)
    turtle.pd()
    turtle.circle(10)
    turtle.end_fill()
コード例 #4
0
ファイル: Zadanie_2.py プロジェクト: ujanlabs/miniLogia_Py
def ustDoNastElem(dlBokMalKw):
    turtle.pu()
    turtle.rt(90)
    turtle.fd(dlBokMalKw * 5)
    turtle.lt(90)
    turtle.fd(dlBokMalKw)
    turtle.pd()
コード例 #5
0
ファイル: Zadanie_4.py プロジェクト: ujanlabs/miniLogia_Py
def ustDo2Elki(dlBokKw, bokKr, bokDl):
    turtle.pu()
    turtle.fd(bokKr - dlBokKw *2)
    turtle.rt(90)
    turtle.fd(bokDl - dlBokKw*2)
    turtle.rt(90)
    turtle.pd()
コード例 #6
0
ファイル: Zadanie_4.py プロジェクト: ujanlabs/miniLogia_Py
def ustDoKwadratu(dlBokKw):
    turtle.pu()
    turtle.fd(dlBokKw * 2)
    turtle.lt(90)
    turtle.fd(dlBokKw * 2)
    turtle.lt(90)
    turtle.pd()
コード例 #7
0
ファイル: Zadanie_4.py プロジェクト: ujanlabs/miniLogia_Py
def ustNaStartKwiatki(rozmKanwy, segment):
    turtle.pu()
    turtle.bk(225)
    turtle.lt(90)
    turtle.bk(225)
    turtle.rt(90)
    turtle.pd()
コード例 #8
0
ファイル: Zadanie_4.py プロジェクト: ujanlabs/miniLogia_Py
def ustDoElki(dlBokKw, bokKr):
    turtle.pu()
    turtle.fd(bokKr - dlBokKw)
    turtle.lt(90)
    turtle.fd(dlBokKw)
    turtle.lt(90)
    turtle.pd()
コード例 #9
0
ファイル: meetconf.py プロジェクト: talam16-meet/MEET-YL1
def draw_triangle(x,y):
	turtle.pu()
	turtle.goto(x,y)
	turtle.pd()
	turtle.goto(x+60,y+85)
	turtle.goto(x+85,y)
	turtle.goto(x,y)
コード例 #10
0
ファイル: Zadanie_1.py プロジェクト: ujanlabs/miniLogia_Py
def ustNaStart(a):
    turtle.pu()
    turtle.bk(a)
    turtle.lt(90)
    turtle.fd(a / 2)
    turtle.rt(90)
    turtle.pd()
コード例 #11
0
ファイル: Zadanie_2.py プロジェクト: ujanlabs/miniLogia_Py
def ustDoNastKraw(ile, bokKw=10):
    turtle.pu()
    turtle.lt(90)
    turtle.fd(bokKw)
    turtle.rt(90)
    turtle.rt(180)
    turtle.pd()
コード例 #12
0
ファイル: Zadanie_2.py プロジェクト: ujanlabs/miniLogia_Py
def ustDoNastTetki(orient=1, bokKw=10):
    turtle.pu()
    turtle.rt(90*orient)
    turtle.fd(bokKw*2)
    turtle.lt(90*orient)
    turtle.fd(bokKw*3)
    turtle.pd()
コード例 #13
0
ファイル: Zadanie_1.py プロジェクト: ujanlabs/miniLogia_Py
def szach(n):
    ustNaStart()
    numPowX = 1
    numPowY = 1
    bok = floor(450 / n)
    while(numPowY <= n / 2):
        while(numPowX <= n / 2):
            parzDwaKwadraty(bok)
            numPowX = numPowX + 1
        korDuza(n)
        turtle.pu()
        turtle.lt(90)
        turtle.fd(bok)
        turtle.rt(90)
        turtle.pd()
        numPowX = 1
        while(numPowX <= n / 2):
            nieParzDwaKwadraty(bok)
            numPowX = numPowX + 1
        korDuza(n)
        turtle.pu()
        turtle.lt(90)
        turtle.fd(bok)
        turtle.rt(90)
        turtle.pd()
        numPowX = 1
        numPowY = numPowY + 1
コード例 #14
0
ファイル: neural2.py プロジェクト: glutzic/bob
	def doDraw(self, turtle):
		turtle.pu()
		turtle.setpos(self.x1, self.y1)
		turtle.pd()
		turtle.goto(self.x2, self.y2)
		turtle.pu()
		return
コード例 #15
0
ファイル: ameenproject.py プロジェクト: ameen16-meet/MEET-YL1
def circle(x,y,size):
	turtle.pu()
	turtle.goto(x,y)
	turtle.pd()
	turtle.begin_fill()
	turtle.circle(size)
	turtle.end_fill()
コード例 #16
0
ファイル: Zadanie_3.py プロジェクト: ujanlabs/miniLogia_Py
def element(bok):
    przeciwProst = sqrt((bok**2)*2)
    numPow = 1
    najmnElem(bok)
    turtle.pu()
    turtle.lt(45)
    turtle.fd(bok)
    turtle.rt(45)
    turtle.fd(przeciwProst)
    turtle.lt(45)
    turtle.fd(bok)
    turtle.rt(45)
    turtle.pd()
    while numPow <= 4:
        najmnElem(bok)
        turtle.rt(45)
        turtle.fd(bok)
        turtle.rt(45)
        kwadrat(przeciwProst)
        turtle.fd(przeciwProst)
        turtle.rt(45)
        turtle.fd(bok)
        turtle.rt(45)
        najmnElem(bok)
        turtle.lt(45)
        turtle.fd(bok*2)
        turtle.lt(45)
        numPow = numPow + 1
コード例 #17
0
ファイル: Zadanie_3.py プロジェクト: ujanlabs/miniLogia_Py
def ustNaStart(dlBokKw, ile):
    turtle.pu()
    turtle.bk(dlBokKw * ile / 2 +5)
    turtle.lt(90)
    turtle.fd(dlBokKw * (ile - 2) / 2 - 5)
    turtle.rt(90)
    turtle.pd()
コード例 #18
0
ファイル: Zadanie_2.py プロジェクト: ujanlabs/miniLogia_Py
def ustNaStart(r):
    turtle.lt(90)
    turtle.pu()
    turtle.rt(90)
    turtle.fd(r)
    turtle.lt(90)
    turtle.pd()
コード例 #19
0
ファイル: Zadanie_3.py プロジェクト: ujanlabs/miniLogia_Py
def korDuza(popr,ile):
    turtle.pu()
    turtle.bk(popr * ile)
    turtle.lt(90)
    turtle.bk(popr)
    turtle.rt(90)
    turtle.pd()
コード例 #20
0
def line(a1,b1,a2,b2,c):
    turtle.pu()
    turtle.goto(a1,b1)
    turtle.color(c)
    turtle.pd()
    turtle.pensize(10)
    turtle.goto(a2,b2)
コード例 #21
0
ファイル: ph.py プロジェクト: wraith1995/persistentHomology
def draw_circle(x,y,r,t):
    t.pu()
    t.goto(x+r,y)
    t.setheading(90)
    t.pd()
    t.circle(r)
    t.pu()
コード例 #22
0
ファイル: turtlestuff.py プロジェクト: lgaff/snippets
def turmandel(step, zoom, xres, yres, xthresh, ythresh):
  turtle.setheading(0)
  for y in range(yres):
    turtle.pu()
    turtle.setpos(0, y)
    turtle.pd()
    for x in range(xres):
      x = float(x)
      y = float(y)
      u = float(x)/float((xres/zoom))-xthresh
      v = float(y)/float((yres/zoom))-ythresh
      x0 = float(u)
      y0 = float(v)
      a = 0.0
      b = 0.0
      i = step
      while ((i>0) and (a+b<=4.0)):
        a = float(x0*x0)
        b = float(y0*y0)
        y0 = float(2.0*x0*y0+v)
        x0 = float(a-b+u)
        i = i - 1
      color = i % 255
      turtle.pencolor((color, color, color))
      if i < 1:
        turtle.pencolor((0,0,0))
      turtle.fd(1)
コード例 #23
0
def circle(a,b):
    turtle.color("green")
    turtle.pu()
    turtle.goto(a,b)
    turtle.pd()
    turtle.setheading(90)
    turtle.circle(40)
コード例 #24
0
ファイル: Zadanie_2.py プロジェクト: ujanlabs/miniLogia_Py
def rogi(bok):
    gamma = 90 + 18
    beta = 360 / 5
    alpha = 180 - beta
    romb(bok)
    naGoreRombu(bok)
    turtle.lt(gamma)
    romb(bok)
    naGoreRombu(bok)
    turtle.rt(gamma)
    romb(bok)
    turtle.pu()
    turtle.rt(gamma)
    turtle.fd(bok)
    turtle.lt(beta)
    turtle.fd(60)
    turtle.rt(beta)
    turtle.pd()
    romb(bok)
    naGoreRombu(bok)
    turtle.lt(alpha)
    romb(bok)
    turtle.lt(beta)
    naGoreRombu(bok)
    turtle.lt(beta*1.5)
    naGoreRombu(bok)
    turtle.rt(180)
コード例 #25
0
ファイル: ISTA130_HW2c.py プロジェクト: KrbAlmryde/Homework
def rowOfShapes(number):
    for x in xrange(number):
        hexaTrangle(25,90,randomColor(),randomColor())
        turtle.left(90)
        turtle.pu()
        turtle.fd(15)
        turtle.pd()
コード例 #26
0
ファイル: Zadanie_1.py プロジェクト: ujanlabs/miniLogia_Py
def ustDoNosa(a):
    turtle.pu()
    turtle.rt(60)
    turtle.bk(1.5 * a)
    turtle.fd(4 * a)
    turtle.lt(360 / 6)
    turtle.fd(4 * a)
    turtle.lt(360 / 6)
    turtle.fd(4 * a)
    turtle.lt(360 / 6)
    turtle.rt(180)
    turtle.lt(60)
    turtle.fd(a * 4)
    turtle.lt(120)
    turtle.fd(a * 8)
    turtle.lt(360 / 12)
    turtle.fd(a * 8)
    turtle.lt(360 / 12)
    turtle.fd(a * 8)
    turtle.lt(360 / 12)
    turtle.fd(a * 8)
    turtle.lt(360 / 12)
    turtle.lt(60)
    turtle.fd(8 * a)
    turtle.lt(30)
    turtle.lt(360 / 6)
    turtle.fd(2 * a)
    turtle.rt(360 / 6)
    turtle.fd(2 * a)
    turtle.rt(360/ 6)
    turtle.fd(a * 2)
    turtle.lt(360 / 6)
    turtle.pd()
コード例 #27
0
ファイル: Zadanie_1.py プロジェクト: ujanlabs/miniLogia_Py
def plansza(bok):
    bokMalKw = bok/7
    rDuzKol = bokMalKw
    rMalKol = bokMalKw/2
    numPowPlus = 1
    numPowKola = 1
    ustNaStart(bok)
    turtle.pu() ##W figurach nie ma krawędzi
    duzyKwadrat(bok)
    ustDoPlusa(bokMalKw)
    while numPowPlus <= 4:
        plus(bokMalKw, rMalKol)
        turtle.rt(90)
        turtle.fd(bokMalKw)
        numPowPlus = numPowPlus + 1
    ustDoKol(bokMalKw)
    turtle.fillcolor(250, 250, 0)
    while numPowKola <= 4:
        turtle.rt(90)
        turtle.fd(bokMalKw)
        turtle.lt(180)
        turtle.begin_fill()
        turtle.circle(rDuzKol)
        turtle.end_fill()
        turtle.lt(180)
        turtle.fd(bokMalKw * 6)
        numPowKola = numPowKola + 1
    turtle.pd()
コード例 #28
0
ファイル: Zadanie_1.py プロジェクト: ujanlabs/miniLogia_Py
def ustNaStart():
    turtle.pu()
    turtle.bk(250)
    turtle.lt(90)
    turtle.bk(250)
    turtle.rt(90)
    turtle.pd()
コード例 #29
0
ファイル: turtle_graphics.py プロジェクト: car54giam/Python
def draw():
	size = randint(40, 300)
	angles = (144, 150, 157.5, 160, 165)
	angle = sample(angles, 1)[0]
	
	colors = [
		('#922B21', '#E6B0AA'), ('#76448A', '#D2B4DE'), ('#1F618D', '#AED6F1'), ('#515A5A', '#EAEDED'),
		('#148F77', '#D1F2EB'), ('#B7950B', '#F7DC6F'), ('#F39C12', '#FDEBD0'), ('#BA4A00', '#F6DDCC')]
	color = sample(colors, 1)[0]
	tt.color(color[0], color[1])
	
	x_pos = randint(-200,200)
	y_pos = randint(-200,200)
	tt.pu()
	tt.setpos(x_pos, y_pos)
	start_position = tt.pos()
	tt.pd()
	
	tt.begin_fill()
	while True:
		tt.forward(size)
		tt.left(angle)
		if abs(tt.pos() - start_position) < 1:
			break
	tt.end_fill()
コード例 #30
0
ファイル: Zadanie_1.py プロジェクト: ujanlabs/miniLogia_Py
def ustDoPOka(a):
    turtle.rt(60)
    turtle.bk(a * 1.5)
    turtle.lt(60)
    turtle.pu()
    turtle.rt(180)
    turtle.fd(4 * a)
    turtle.lt(60)
    turtle.fd(4 * a)
    turtle.lt(60)
    turtle.fd(4 * a)
    turtle.rt(60)
    turtle.fd(4 * a)
    turtle.lt(60)
    turtle.lt(360 / 12)
    turtle.fd(a * 8)
    turtle.lt(360 / 12)
    turtle.fd(a * 8)
    turtle.lt(360 / 12)
    turtle.fd(a * 8)
    turtle.lt(360 / 12)
    turtle.lt(60)
    turtle.fd(4 * a)
    turtle.lt(60)
    turtle.fd(a * 4)
    turtle.pd()
コード例 #31
0
ファイル: draw.py プロジェクト: tomdora/cs440Ass1
def start(squareSize):
    turtle.pu()
    turtle.fd(squareSize / 2)
    turtle.rt(90)
    turtle.fd(squareSize / 2)
    turtle.lt(90)
コード例 #32
0
ファイル: pig.py プロジェクト: cwd0204/Python-100-Days
import turtle as t
'''
t.pu()  提起画笔
t.pd()  移动时绘制图形,缺省时也为绘制
t.seth  设置当前朝向为angle角度
t.begin_fill()  准备开始填充图形
t.color      同时设置pencolor=color1, fillcolor=color2
t.goto       设置笔的坐标
t.circle(70,20) 半径 度数
15,124,215  乔治裤子颜色外面
66,163,242  乔治裤子颜色里面

134  196  247  天空的颜色
123,245,95 草地的颜色
253,6,6  鞋子外面
253,70,70  鞋子里面
130,119,100 泥坑


'''
r_a = 0.8
wight = 1100
height = 700
#t.pensize(4)
t.hideturtle()
t.colormode(255)
t.color((255, 155, 192), "pink")
t.setup(wight, height)
t.speed(10)

コード例 #33
0
def gotostart():
    turtle.pu()
    turtle.setx(-300)
    turtle.sety(200)
    turtle.pd()
コード例 #34
0
def drawLine(draw):
    drawGap()
    turtle.pd() if draw else turtle.pu()
    turtle.fd(40)
    drawGap()
    turtle.right(90)
コード例 #35
0
def moveM(tempX, tempY):
    t.pu()  # 提笔
    t.goto(tempX, tempY)  # 画笔前往坐标
    t.pd()  # 下笔
コード例 #36
0
def a():
    t.screensize(400, 300)
    t.pensize(4)  # 设置画笔的大小
    t.colormode(255)  # 设置GBK颜色范围为0-255
    t.color((255, 155, 192), "pink")  # 设置画笔颜色和填充颜色(pink)
    t.setup(840, 500)  # 设置主窗口的大小为840*500
    t.speed(20)  # 设置画笔速度为10
    # 鼻子
    t.pu()  # 提笔
    t.goto(-100, 100)  # 画笔前往坐标(-100,100)
    t.pd()  # 下笔
    t.seth(-30)  # 笔的角度为-30°
    t.begin_fill()  # 外形填充的开始标志
    a = 0.4
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            a = a + 0.08
            t.lt(3)  # 向左转3度
            t.fd(a)  # 向前走a的步长
        else:
            a = a - 0.08
            t.lt(3)
            t.fd(a)
    t.end_fill()  # 依据轮廓填充
    t.pu()  # 提笔
    t.seth(90)  # 笔的角度为90度
    t.fd(25)  # 向前移动25
    t.seth(0)  # 转换画笔的角度为0
    t.fd(10)
    t.pd()
    t.pencolor(255, 155, 192)  # 设置画笔颜色
    t.seth(10)
    t.begin_fill()
    t.circle(5)  # 画一个半径为5的圆
    t.color(160, 82, 45)  # 设置画笔和填充颜色
    t.end_fill()
    t.pu()
    t.seth(0)
    t.fd(20)
    t.pd()
    t.pencolor(255, 155, 192)
    t.seth(10)
    t.begin_fill()
    t.circle(5)
    t.color(160, 82, 45)
    t.end_fill()
    # 头
    t.color((255, 155, 192), "pink")
    t.pu()
    t.seth(90)
    t.fd(41)
    t.seth(0)
    t.fd(0)
    t.pd()
    t.begin_fill()
    t.seth(180)
    t.circle(300, -30)  # 顺时针画一个半径为300,圆心角为30°的园
    t.circle(100, -60)
    t.circle(80, -100)
    t.circle(150, -20)
    t.circle(60, -95)
    t.seth(161)
    t.circle(-300, 15)
    t.pu()
    t.goto(-100, 100)
    t.pd()
    t.seth(-30)
    a = 0.4
    for i in range(60):
        if 0 <= i < 30 or 60 <= i < 90:
            a = a + 0.08
            t.lt(3)  # 向左转3度
            t.fd(a)  # 向前走a的步长
        else:
            a = a - 0.08
            t.lt(3)
            t.fd(a)
    t.end_fill()
    # 耳朵
    t.color((255, 155, 192), "pink")
    t.pu()
    t.seth(90)
    t.fd(-7)
    t.seth(0)
    t.fd(70)
    t.pd()
    t.begin_fill()
    t.seth(100)
    t.circle(-50, 50)
    t.circle(-10, 120)
    t.circle(-50, 54)
    t.end_fill()
    t.pu()
    t.seth(90)
    t.fd(-12)
    t.seth(0)
    t.fd(30)
    t.pd()
    t.begin_fill()
    t.seth(100)
    t.circle(-50, 50)
    t.circle(-10, 120)
    t.circle(-50, 56)
    t.end_fill()
    # 眼睛
    t.color((255, 155, 192), "white")
    t.pu()
    t.seth(90)
    t.fd(-20)
    t.seth(0)
    t.fd(-95)
    t.pd()
    t.begin_fill()
    t.circle(15)
    t.end_fill()
    t.color("black")
    t.pu()
    t.seth(90)
    t.fd(12)
    t.seth(0)
    t.fd(-3)
    t.pd()
    t.begin_fill()
    t.circle(3)
    t.end_fill()
    t.color((255, 155, 192), "white")
    t.pu()
    t.seth(90)
    t.fd(-25)
    t.seth(0)
    t.fd(40)
    t.pd()
    t.begin_fill()
    t.circle(15)
    t.end_fill()
    t.color("black")
    t.pu()
    t.seth(90)
    t.fd(12)
    t.seth(0)
    t.fd(-3)
    t.pd()
    t.begin_fill()
    t.circle(3)
    t.end_fill()
    # 腮
    t.color((255, 155, 192))
    t.pu()
    t.seth(90)
    t.fd(-95)
    t.seth(0)
    t.fd(65)
    t.pd()
    t.begin_fill()
    t.circle(30)
    t.end_fill()
    # 嘴
    t.color(239, 69, 19)
    t.pu()
    t.seth(90)
    t.fd(15)
    t.seth(0)
    t.fd(-100)
    t.pd()
    t.seth(-80)
    t.circle(30, 40)
    t.circle(40, 80)
    # 身体
    t.color("red", (255, 99, 71))
    t.pu()
    t.seth(90)
    t.fd(-20)
    t.seth(0)
    t.fd(-78)
    t.pd()
    t.begin_fill()
    t.seth(-130)
    t.circle(100, 10)
    t.circle(300, 30)
    t.seth(0)
    t.fd(230)
    t.seth(90)
    t.circle(300, 30)
    t.circle(100, 3)
    t.color((255, 155, 192), (255, 100, 100))
    t.seth(-135)
    t.circle(-80, 63)
    t.circle(-150, 24)
    t.end_fill()
    # 手
    t.color((255, 155, 192))
    t.pu()
    t.seth(90)
    t.fd(-40)
    t.seth(0)
    t.fd(-27)
    t.pd()
    t.seth(-160)
    t.circle(300, 15)
    t.pu()
    t.seth(90)
    t.fd(15)
    t.seth(0)
    t.fd(0)
    t.pd()
    t.seth(-10)
    t.circle(-20, 90)
    t.pu()
    t.seth(90)
    t.fd(30)
    t.seth(0)
    t.fd(237)
    t.pd()
    t.seth(-20)
    t.circle(-300, 15)
    t.pu()
    t.seth(90)
    t.fd(20)
    t.seth(0)
    t.fd(0)
    t.pd()
    t.seth(-170)
    t.circle(20, 90)
    # 脚
    t.pensize(10)
    t.color((240, 128, 128))
    t.pu()
    t.seth(90)
    t.fd(-75)
    t.seth(0)
    t.fd(-180)
    t.pd()
    t.seth(-90)
    t.fd(40)
    t.seth(-180)
    t.color("black")
    t.pensize(15)
    t.fd(20)
    t.pensize(10)
    t.color((240, 128, 128))
    t.pu()
    t.seth(90)
    t.fd(40)
    t.seth(0)
    t.fd(90)
    t.pd()
    t.seth(-90)
    t.fd(40)
    t.seth(-180)
    t.color("black")
    t.pensize(15)
    t.fd(20)
    # 尾巴
    t.pensize(4)
    t.color((255, 155, 192))
    t.pu()
    t.seth(90)
    t.fd(70)
    t.seth(0)
    t.fd(95)
    t.pd()
    t.seth(0)
    t.circle(70, 20)
    t.circle(10, 330)
    t.circle(70, 30)
    t.reset()
コード例 #37
0
def Tick():
    now = time.localtime()
    now_time.n_sec = now.tm_sec
    turtle.reset()
    turtle.hideturtle()
    turtle.pu()
    turtle.fd(-300)

    darwDate(str(now.tm_year), '(255, 69, 0)')
    turtle.fd(10)
    turtle.right(90)
    turtle.fd(30)
    turtle.write('年', align="center", font=("Courier", 30, "bold"))
    turtle.left(180)
    turtle.fd(30)
    turtle.right(90)
    turtle.fd(30)

    darwDate(str(now.tm_mon), '(0,139,0)')
    turtle.fd(10)
    turtle.right(90)
    turtle.fd(30)
    turtle.write('月', align="center", font=("Courier", 30, "bold"))
    turtle.left(180)
    turtle.fd(30)
    turtle.right(90)
    turtle.fd(30)

    darwDate(str(now.tm_mday), '(0,0,139)')
    turtle.fd(10)
    turtle.right(90)
    turtle.fd(30)
    turtle.write('日', align="center", font=("Courier", 30, "bold"))
    turtle.left(180)
    turtle.fd(-90)
    turtle.right(90)
    turtle.fd(-510)

    darwDate(str(now.tm_hour))
    turtle.fd(10)
    turtle.right(90)
    turtle.fd(30)
    turtle.write('时', align="center", font=("Courier", 30, "bold"))
    turtle.left(180)
    turtle.fd(30)
    turtle.right(90)
    turtle.fd(30)

    darwDate(str(now.tm_min))
    turtle.fd(10)
    turtle.right(90)
    turtle.fd(30)
    turtle.write('分', align="center", font=("Courier", 30, "bold"))
    turtle.left(180)
    turtle.fd(30)
    turtle.right(90)
    turtle.fd(30)

    darwDate(str(now.tm_sec))
    turtle.fd(10)
    turtle.right(90)
    turtle.fd(30)
    turtle.write('秒', align="center", font=("Courier", 30, "bold"))
    turtle.left(180)
    turtle.fd(30)
    turtle.right(90)
    turtle.fd(30)

    timer = threading.Timer(0.1, Tick)  # 利用多线程库定时刷新
    timer.start()
コード例 #38
0
        for j in range(5):  #每行五个
            turtle.goto(x, y)  #画笔移动到x,y
            turtle.color('white')
            turtle.begin_fill()
            for k in range(5):  ##画每一个星星
                turtle.left(144)
                turtle.forward(20)
            x -= 50
            turtle.end_fill()
        y += 350 / 13 * 2


turtle.setup(0.8, 0.8, -100, -100)  #弹出框初始比例和海归初始位置
#turtle.screensize(800,600,'black') #设置屏幕大小和颜色
turtle.speed(10)  #绘图速度
turtle.pu()  #隐藏画笔画出的线

turtle.forward(300)
turtle.left(90)
turtle.forward(350 / 2)
turtle.left(90)

drawSquar()  #调用画国旗的条纹

turtle.home()  #海归画笔初始化

drawSmallsqure()  #调用画国旗左上角的小矩形

turtle.home()

drawSrarts()  #调用画左上角的小星星
コード例 #39
0
def game_start(x, y):
    t.pu()
    t.goto(x, y)
    t.pd()
    t.speed(0)
コード例 #40
0
ファイル: draw.py プロジェクト: tomdora/cs440Ass1
def corner(borderSize):
    turtle.seth(0)
    turtle.pu()
    turtle.goto(-round(borderSize / 2), round(borderSize / 2))
    turtle.pd()
コード例 #41
0
ファイル: House.py プロジェクト: daksh-git/Turtle_Codes
import turtle as bob

bob.pensize(2)
bob.speed(0)

bob.pu()
bob.goto(-100, -100)
bob.fd(100)
bob.pd()

# Side Rectangle
bob.color("black", "#FFF62F")
bob.begin_fill()

bob.setheading(10)
bob.fd(300)
bob.setheading(90)
bob.fd(150)
bob.setheading(190)
bob.fd(300)
bob.setheading(270)
bob.fd(150)
bob.end_fill()

bob.color("black", "#9E1795")
bob.begin_fill()
bob.setheading(10)
bob.fd(50)
bob.setheading(90)
bob.pu()
bob.fd(48)
import turtle as tu
import time, sys
try:
    rabbo=Rabboni(mode="BLE")
except Exception as e:
    print(e)
    print("fail")
    sys.exit( )
    rabbo.scan() #掃描所有藍芽 Device
rabbo.print_device() # 列出所有藍芽 Device
rabbo.connect("E2:A4:E9:1D:38:D2")#依照 MAC 連接
rabbo.discover_characteristics()#掃描所有服務 可略過
rabbo.read_data()#讀取資料 必跑
x=-350
y=0
tu.pu()
tu.goto(x,y)
tu.pd()
tu.goto(350,0)
tu.pu()
tu.goto(x,y)
f=-320
tu.pd()
tu.hideturtle()
tu.speed(10)
a=rabbo.Accx
k=15 #可調整,警告數字
o=19 #可調整,計算數字
sea=0
tu.speed(5)
while True:
コード例 #43
0
ファイル: 画老婆.py プロジェクト: ZZ1314/Learn_Code
# coding: utf-8

import turtle as t

t.speed(0)
t.hideturtle()
t.screensize(400, 300)
t.pensize(4)  # 设置画笔的大小
t.colormode(255)  # 设置GBK颜色范围为0-255
t.color((255, 155, 192), "pink")  # 设置画笔颜色和填充颜色(pink)
t.setup(840, 500)  # 设置主窗口的大小为840*500
t.speed(10)  # 设置画笔速度为10
# 鼻子
t.pu()  # 提笔
t.goto(-100, 100)  # 画笔前往坐标(-100,100)
t.pd()  # 下笔
t.seth(-30)  # 笔的角度为-30°
t.begin_fill()  # 外形填充的开始标志
a = 0.4
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.08
        t.lt(3)  # 向左转3度
        t.fd(a)  # 向前走a的步长
    else:
        a = a - 0.08
        t.lt(3)
        t.fd(a)
t.end_fill()  # 依据轮廓填充
t.pu()  # 提笔
t.seth(90)  # 笔的角度为90度
コード例 #44
0
# coding:utf-8
import turtle as t
t.pensize(4)  # set the pen size 设置画笔的大小
t.colormode(255)  #  set the color of GBK 设置GBK颜色范围为0-255
t.color((255, 155, 192),
        "pink")  # set the pen color(pink) and fill it 设置画笔颜色和填充颜色(pink)
t.setup(840, 500)  # set the size of main window 设置主窗口的大小为840*500
t.speed(20)  # set the speed of drawing 设置画笔速度为10

# draw Peppa Pig's nose
t.pu()  # use the pen 提笔
t.goto(-100, 100)  # go to (-100, 100) 画笔前往坐标(-100,100)
t.pd()  # begin to draw 下笔
t.seth(-30)  # set the angle of the pen (-30°) 笔的角度为-30°
t.begin_fill()  # the signal to fill the figure 外形填充的开始标志
a = 0.4  # preset the step length
for i in range(120):
    if 0 <= i < 30 or 60 <= i < 90:
        a = a + 0.08
        t.lt(3)  # turn left 3 degrees向左转3度
        t.fd(a)  # go forward step "a" 向前走a的步长
    else:
        a = a - 0.08
        t.lt(3)
        t.fd(a)
t.end_fill()  # fill the color 依据轮廓填充

# draw Peppa Pig's nostrils
t.pu()  # use the pen提笔
t.seth(90)  # set the angle of the pen(90°) 笔的角度为90度
t.fd(25)  # go forward 25 steps 向前移动25
コード例 #45
0
def drawGap():
    turtle.pu()
    turtle.fd(5)
コード例 #46
0
ファイル: koch.py プロジェクト: mikikora/University
from turtle import fd, rt, lt, tracer, update, pu, pd, goto

def koch (N):
    if N < 5:
        fd(N)
    else:
        koch(N/3)
        lt(60)
        koch(N/3)
        rt(120)
        koch(N/3)
        lt(60)
        koch(N/3)
        
tracer(0,1)
pu()
goto(-250,250)
pd()
for i in range(3):
    koch(1000)
    rt(120)

update()
input()
コード例 #47
0
@author:KING 
@file: pig.py 
@time: 2018/05/05 
"""

import turtle as t

t.pensize(4)
t.hideturtle()
t.colormode(255)
t.color((255,155,192),"pink")
t.setup(840,500)
t.speed(10)

#鼻子
t.pu()
t.goto(-100,100)
t.pd()
t.seth(-30)
t.begin_fill()
a=0.4
for i in range(120):
    if 0<=i<30 or 60<=i<90:
        a=a+0.08
        t.lt(3) #向左转3度
        t.fd(a) #向前走a的步长
    else:
        a=a-0.08
        t.lt(3)
        t.fd(a)
t.end_fill()
コード例 #48
0
def camp():
    turtle.title("TactiHack")
    turtle.bgcolor("#000000")
    turtle.up()
    turtle.screensize(5000, 3000)  #screensize
    turtle.hideturtle()  #make the turtle invisible
    #cuadro
    turtle.speed(1000)
    turtle.color("#00A510")
    turtle.pencolor("#FFFFFF")
    turtle.pensize(15)
    turtle.goto(-600, 310)
    turtle.pd()
    turtle.begin_fill()
    turtle.forward(1200)
    turtle.right(90)
    turtle.forward(600)
    turtle.right(90)
    turtle.forward(1200)
    turtle.right(90)
    turtle.forward(600)
    turtle.end_fill()

    #circulo
    turtle.pu()
    turtle.pencolor("#FFFFFF")
    turtle.pensize(5)
    turtle.goto(60, 10)
    turtle.pd()
    turtle.circle(60)
    #linea media
    turtle.pu()
    turtle.goto(0, 310)
    turtle.pd()
    turtle.goto(0, -290)
    #areas
    turtle.pu()
    turtle.goto(-600, 160)
    turtle.pd()
    turtle.rt(90)
    camp2(200, 300)

    turtle.pu()
    turtle.goto(-600, 90)
    turtle.rt(90)
    camp2(130, 165)

    turtle.pu()
    turtle.goto(-400, -40)
    turtle.rt(90)
    turtle.pd()
    #turtle.circle(120, 90) esquina
    turtle.circle(60, 180)

    turtle.pu()
    turtle.goto(600, -140)

    turtle.pd()
    turtle.rt(360)
    camp2(200, 300)

    turtle.pu()
    turtle.goto(600, -70)
    turtle.rt(90)
    camp2(130, 165)

    turtle.pu()
    turtle.goto(400, 75)
    turtle.rt(90)
    turtle.pd()
    turtle.circle(60, 180)

    turtle.pu()
    turtle.goto(600, -245)
    turtle.rt(180)
    turtle.pd()
    turtle.circle(50, 90)

    turtle.pu()
    turtle.goto(-600, 245)
    turtle.rt(270)
    turtle.pd()
    turtle.circle(50, 90)

    turtle.pu()
    turtle.goto(555, 310)
    turtle.rt(180)
    turtle.pd()
    turtle.circle(50, 90)

    turtle.pu()
    turtle.goto(-555, -290)
    turtle.rt(270)
    turtle.pd()
    turtle.circle(50, 90)
    #estrella()
    turtle.pu()
    turtle.goto(0, 10)
    turtle.rt(180)
コード例 #49
0
ファイル: 2_9.py プロジェクト: x17352620601/python
import turtle
turtle.pu()
turtle.fd(-300)
turtle.pd()

turtle.pensize(10)
turtle.pencolor("red")
for i in range(10):
    turtle.seth(90 + 20 * i)
    turtle.circle(20, 100)
    turtle.circle(-20, 100)
turtle.pencolor("grenn")
turtle.fd(40)
turtle.seth(180)
turtle.fd(30)
コード例 #50
0
def nextshape():
    turtle.pu()
    turtle.fd(50)
    turtle.pd()
コード例 #51
0
ファイル: piaoluo.py プロジェクト: 1987617587/lsh_py
            #画叶子
            T.pd()
            T.right(90)
            n = cos(radians(T.heading() - 45)) / 4 + 0.5
            T.pencolor(n * 0.5 + 0.5, 0.4 + n * 0.4, 0.4 + n * 0.4)
            T.circle(2)
            T.left(90)
            T.pu()
            #返回
            t = T.heading()
            T.setheading(an)
            T.backward(dis)
            T.setheading(t)
    T.pu()
    T.backward(l)  #退回
    # time.sleep(0.01)


T.bgcolor(0.5, 0.5, 0.5)  #背景色
T.ht()  #隐藏turtle
T.speed(0)  #速度 1-10渐进,0 最快
T.tracer(0, 0)
T.pu()  #抬笔
T.backward(100)
T.left(90)  #左转90度
T.pu()  #抬笔
T.backward(300)  #后退300
tree(12, 100)  #递归7层

T.done()
コード例 #52
0
def draw_body(initx, inity):

    ###body
    t.pu()
    t.goto(initx, inity)
    t.pd()
    t.pensize(3)
    t.color('black', '#FF6464')
    t.begin_fill()
    t.seth(105)
    t.circle(80, 160)
    t.fd(50)
    t.right(10)
    t.circle(88, 150)
    t.circle(120, 20)
    t.left(20)
    t.fd(30)
    t.left(13)
    t.fd(40)
    t.left(1)
    t.fd(45) 
    t.end_fill()    

    ###Eyes1
    t.pu()
    t.goto(initx + -20, inity + -10)
    t.seth(90)
    t.pd()
    t.begin_fill()
    t.color('black','white')
    t.circle(22, 360)
    t.end_fill()
    ###White in eyes
    t.circle(22, 280)
    t.begin_fill()
    t.color('black','black')
    t.circle(22, 180)
    #t.seth(280)
    #t.fd(44)
    t.end_fill()
 
    ###Mouth
    t.pu()
    t.goto(initx-7, inity + -30)
    t.pd()
    t.seth(330)
    t.circle(10, 70)    
    
    ###Z1
    t.pu()
    t.goto(initx + -70, inity + -40)
    t.pd()
    t.pensize(5)
    t.pencolor('yellow')
    t.seth(-5)
    t.fd(25)
    t.right(160)
    t.fd(25)
    t.left(155)
    t.fd(25)
    t.pu()    
コード例 #53
0
    main_menu()

    user_health = max_user_health
    user_stamina = max_user_stamina
    user_mana = max_user_mana
    monster_pic = 'Pig'
    max_monsterHP = 150
    monster_health = max_monsterHP


#Setup
screen = turtle.Screen()
screen.setup(900, 500)  #sier start størrelsen og hvor skjermen skal dukke opp
turtle.ht()  # ht = hideturtle
turtle.pu()  # pu = penup
turtle.speed(0)

#---------Laging av Turtles---------

#Tekst turtles
text_MainM = turtle.clone()
text_exit = turtle.clone()
text_expl = turtle.clone()
text_attack = turtle.clone()
status = turtle.clone()
monster_status_turtle = turtle.clone()

#Knappe format til andre knapper
exit_knapp = turtle.clone()  #cloner turtlen
exit_knapp.shape('circle')  #registrerer formen på turtlen
コード例 #54
0
ファイル: SnowMan.py プロジェクト: Suhail-Athar/Python
hail.penup()
hail.goto(-70, 145)
hail.pensize(3)
hail.pendown()
hail.fillcolor("maroon")
hail.begin_fill()
hail.goto(70,145)
hail.left(90)
hail.goto(70, 165)
hail.left(90)
hail.goto(40, 165)
hail.left(90)
hail.goto(40, 200)
hail.left(90)
hail.goto(-40,200)
hail.left(90)
hail.goto(-40,165)
hail.right(90)
hail.goto(-70,165)
hail.left(90)
hail.goto(-70,145)
hail.end_fill()
hail.pu()

#Heading
hail.goto(-111,220)
hail.pd()
hail.color('#85C1E9')
hail.write("SNOW-MAN", move=True, font=("Verdana",30, "normal"))
hail.ht()
hail.done()
コード例 #55
0
ファイル: classwork.py プロジェクト: AndruKP/school_IT
def worm():
    t.pensize(3)
    t.color('black', 'green')

    t.pu()
    t.goto(-400, 100)
    t.pd()

    t.begin_fill()
    t.circle(-100)
    t.end_fill()

    t.pu()
    t.goto(-250, 25)
    t.pd()

    t.begin_fill()
    t.circle(-100)
    t.end_fill()

    t.pu()
    t.goto(-50, 0)
    t.pd()

    t.begin_fill()
    t.circle(-100)
    t.end_fill()

    t.pu()
    t.goto(100, -125)
    t.pd()

    t.begin_fill()
    t.circle(-100)
    t.end_fill()

    t.pu()
    t.goto(250, -200)
    t.pd()

    t.begin_fill()
    t.circle(100)
    t.end_fill()

    t.pu()
    t.goto(350, -25)
    t.pd()

    t.begin_fill()
    t.circle(100)
    t.end_fill()

    t.pu()
    t.goto(300, 50)
    t.pd()

    t.color('red')
    t.goto(350, 25)
    t.goto(400, 50)

    t.pu()
    t.goto(325, 175)
    t.pd()

    t.color('black')
    t.goto(300, 250)
    t.goto(250, 200)

    t.pu()
    t.goto(375, 175)
    t.pd()

    t.goto(400, 250)
    t.goto(450, 200)

    t.st()
コード例 #56
0
ファイル: pig.py プロジェクト: cwd0204/Python-100-Days
def move_pen(x, y):
    t.pu()
    t.goto(x - wight / 2 + 50, y - height / 2 + 50)
    t.pd()
コード例 #57
0
def drawGap():  #绘制数码管间隔
    #提起画笔
    tl.pu()
    # 数码管间隔
    tl.fd(9)
コード例 #58
0
import turtle as tt
from math import sqrt

tt.setup(600, 600)			# 设置 600 x 600 的画布并居中
tt.hideturtle()				# 隐藏画笔
tt.pensize(6)				# 设置画笔粗细
tt.pencolor("#00f5ff")		# 设置画笔颜色

# 走到右上角
tt.seth(45)
tt.pu()
tt.fd(200)
tt.pd()

# 鱼的“脑门”
tt.seth(135)
tt.circle(200, 130)			# 相当于极坐标的 roll(r, angle)

# 鱼嘴
tt.pu()
tt.circle(200, 10)
tt.pd()

# 鱼腹
tt.circle(200, 130)

# 鱼“屁股”
tt.seth(0)
tt.circle(200/sqrt(2), -90)

# 鱼尾(开始)
コード例 #59
0
ファイル: Panda.py プロジェクト: daksh-git/Turtle_Codes
def go_to_start():
    bob.speed(0)
    bob.pu()
    bob.goto(0, -200)
    bob.pd()
コード例 #60
0
turtle.fd(100)


# remember you can make a function called draw_square
def draw_square(size):
    for i in range(4):
        turtle.fd(size)
        turtle.rt(90)


# tell turtle to get ready to fill shape
turtle.begin_fill()
# set color to fill with
turtle.fillcolor('yellow')
# draw the square
draw_square(100)
# done filling color
turtle.end_fill()
# set background color
turtle.bgcolor('navy')
# move turtle to a new position
turtle.pu()  # pick up the pen (to move without drawing)
turtle.goto(200, -200)  # move to new location
turtle.pd()  # put the pen back down (to draw again)
turtle.begin_fill()
turtle.fillcolor('white')
draw_square(25)  # draw a smaller square
turtle.end_fill()
# finsihed drawing so the turtle is done
turtle.done()