Python绘制哆啦A梦、皮卡丘、圣诞树_python中notrace goto是什么意思

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

seth(165)
fd(60)

my_goto(-32, 125)
seth(180)
fd(60)

my_goto(-32, 115)
seth(193)
fd(60)

my_goto(37, 135)
seth(15)
fd(60)

my_goto(37, 125)
seth(0)
fd(60)

my_goto(37, 115)
seth(-13)
fd(60)

嘴巴

def mouth():
my_goto(5, 148)
seth(270)
fd(100)
seth(0)
circle(120, 50)
seth(230)
circle(-120, 100)

围巾

def scarf():
fillcolor(‘#e70010’)
begin_fill()
seth(0)
fd(200)
circle(-5, 90)
fd(10)
circle(-5, 90)
fd(207)
circle(-5, 90)
fd(10)
circle(-5, 90)
end_fill()

鼻子

def nose():
my_goto(-10, 158)
seth(315)
fillcolor(‘#e70010’)
begin_fill()
circle(20)
end_fill()

黑眼睛

def black_eyes():
seth(0)
my_goto(-20, 195)
fillcolor(‘#000000’)
begin_fill()
circle(13)
end_fill()

pensize(6)
my_goto(20, 205)
seth(75)
circle(-10, 150)
pensize(3)

my_goto(-17, 200)
seth(0)
fillcolor('#ffffff')
begin_fill()
circle(5)
end_fill()
my_goto(0, 0)

def face():
fd(183)
lt(45)
fillcolor(‘#ffffff’)
begin_fill()
circle(120, 100)
seth(180)
# print(pos())
fd(121)
pendown()
seth(215)
circle(120, 100)
end_fill()
my_goto(63.56, 218.24)
seth(90)
eyes()
seth(180)
penup()
fd(60)
pendown()
seth(90)
eyes()
penup()
seth(180)
fd(64)

头型

def head():
penup()
circle(150, 40)
pendown()
fillcolor(‘#00a0de’)
begin_fill()
circle(150, 280)
end_fill()

画哆啦A梦

def Doraemon():
# 头部
head()

# 围脖
scarf()

# 脸
face()

# 红鼻子
nose()

# 嘴巴
mouth()

# 胡须
beard()

# 身体
my_goto(0, 0)
seth(0)
penup()
circle(150, 50)
pendown()
seth(30)
fd(40)
seth(70)
circle(-30, 270)

fillcolor('#00a0de')
begin_fill()

seth(230)
fd(80)
seth(90)
circle(1000, 1)
seth(-89)
circle(-1000, 10)

# print(pos())

seth(180)
fd(70)
seth(90)
circle(30, 180)
seth(180)
fd(70)

# print(pos())
seth(100)
circle(-1000, 9)

seth(-86)
circle(1000, 2)
seth(230)
fd(40)

# print(pos())

circle(-30, 230)
seth(45)
fd(81)
seth(0)
fd(203)
circle(5, 90)
fd(10)
circle(5, 90)
fd(7)
seth(40)
circle(150, 10)
seth(30)
fd(40)
end_fill()

# 左手
seth(70)
fillcolor('#ffffff')
begin_fill()
circle(-30)
end_fill()

# 脚
my_goto(103.74, -182.59)
seth(0)
fillcolor('#ffffff')
begin_fill()
fd(15)
circle(-15, 180)
fd(90)
circle(-15, 180)
fd(10)
end_fill()

my_goto(-96.26, -182.59)
seth(180)
fillcolor('#ffffff')
begin_fill()
fd(15)
circle(15, 180)
fd(90)
circle(15, 180)
fd(10)
end_fill()

# 右手
my_goto(-133.97, -91.81)
seth(50)
fillcolor('#ffffff')
begin_fill()
circle(30)
end_fill()

# 口袋
my_goto(-103.42, 15.09)
seth(0)
fd(38)
seth(230)
begin_fill()
circle(90, 260)
end_fill()

my_goto(5, -40)
seth(0)
fd(70)
seth(-90)
circle(-70, 180)
seth(0)
fd(70)

# 铃铛
my_goto(-103.42, 15.09)
fd(90)
seth(70)
fillcolor('#ffd200')
# print(pos())
begin_fill()
circle(-20)
end_fill()
seth(170)
fillcolor('#ffd200')
begin_fill()
circle(-2, 180)
seth(10)
circle(-100, 22)
circle(-2, 180)
seth(180 - 10)
circle(100, 22)
end_fill()
goto(-13.42, 15.09)
seth(250)
circle(20, 110)
seth(90)
fd(15)
dot(10)
my_goto(0, -150)

# 画眼睛
black_eyes()

if name == ‘__main__’:
screensize(800, 600, “#f0f0f0”)
pensize(3) # 画笔宽度
speed(9) # 画笔速度
Doraemon()
my_goto(100, -300)
write(‘CSDN北山啦’, font=(“Bradley Hand ITC”, 30, “bold”))
mainloop()


### turtle绘制皮卡丘


![在这里插入图片描述](https://img-blog.csdnimg.cn/2021022311345326.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1MTc2NTQ4,size_30,color_FFFFFF,t_70)



import turtle

def getPosition(x, y):
turtle.setx(x)
turtle.sety(y)
print(x, y)

class Pikachu:

def \_\_init\_\_(self):
    self.t = turtle.Turtle()
    t = self.t
    t.pensize(3)
    t.speed(9)
    t.ondrag(getPosition)


    
def noTrace\_goto(self, x, y):
    self.t.penup()
    self.t.goto(x, y)
    self.t.pendown()

def leftEye(self, x, y):
    self.noTrace_goto(x, y)
    t = self.t
    t.seth(0)
    t.fillcolor('#333333')
    t.begin_fill()
    t.circle(22)
    t.end_fill()

    self.noTrace_goto(x, y+10)
    t.fillcolor('#000000')
    t.begin_fill()
    t.circle(10)
    t.end_fill()

    self.noTrace_goto(x+6, y + 22)
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.circle(10)
    t.end_fill()

def rightEye(self, x, y):
    self.noTrace_goto(x, y)
    t = self.t
    t.seth(0)
    t.fillcolor('#333333')
    t.begin_fill()
    t.circle(22)
    t.end_fill()

    self.noTrace_goto(x, y+10)
    t.fillcolor('#000000')
    t.begin_fill()
    t.circle(10)
    t.end_fill()

    self.noTrace_goto(x-6, y + 22)
    t.fillcolor('#ffffff')
    t.begin_fill()
    t.circle(10)
    t.end_fill()

def mouth(self, x, y):
    self.noTrace_goto(x, y)
    t = self.t

    t.fillcolor('#88141D')
    t.begin_fill()
    # 下嘴唇
    l1 = []
    l2 = []
    t.seth(190)
    a = 0.7
    for i in range(28):
        a += 0.1
        t.right(3)
        t.fd(a)
        l1.append(t.position())
    
    self.noTrace_goto(x, y)
    
    t.seth(10)
    a = 0.7
    for i in range(28):
        a += 0.1
        t.left(3)
        t.fd(a)
        l2.append(t.position())
    
    # 上嘴唇
    
    t.seth(10)
    t.circle(50, 15)
    t.left(180)
    t.circle(-50, 15)
    
    t.circle(-50, 40)
    t.seth(233)
    t.circle(-50, 55)
    t.left(180)
    t.circle(50, 12.1)
    t.end_fill()

    # 舌头
    self.noTrace_goto(17, 54)
    t.fillcolor('#DD716F')
    t.begin_fill()
    t.seth(145)
    t.circle(40, 86)
    t.penup()
    for pos in reversed(l1[:20]):
        t.goto(pos[0], pos[1]+1.5)
    for pos in l2[:20]:
        t.goto(pos[0], pos[1]+1.5)
    t.pendown()
    t.end_fill()

    # 鼻子
    self.noTrace_goto(-17, 94)
    t.seth(8)
    t.fd(4)
    t.back(8)

# 红脸颊
def leftCheek(self, x, y):
    turtle.tracer(False)
    t = self.t
    self.noTrace_goto(x, y)
    t.seth(300)
    t.fillcolor('#DD4D28')
    t.begin_fill()
    a = 2.3
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            a -= 0.05
            t.lt(3)
            t.fd(a)
        else:
            a += 0.05
            t.lt(3)
            t.fd(a)
    t.end_fill()
    turtle.tracer(True)

def rightCheek(self, x, y):
    t = self.t
    turtle.tracer(False)
    self.noTrace_goto(x, y)
    t.seth(60)
    t.fillcolor('#DD4D28')
    t.begin_fill()
    a = 2.3
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            a -= 0.05
            t.lt(3)
            t.fd(a)
        else:
            a += 0.05
            t.lt(3)
            t.fd(a)
    t.end_fill()
    turtle.tracer(True)

def colorLeftEar(self, x, y):
    t = self.t
    self.noTrace_goto(x, y)
    t.fillcolor('#000000')
    t.begin_fill()
    t.seth(330)
    t.circle(100, 35)
    t.seth(219)
    t.circle(-300, 19)
    t.seth(110)
    t.circle(-30, 50)
    t.circle(-300, 10)
    t.end_fill()
    

def colorRightEar(self, x, y):
    t = self.t
    self.noTrace_goto(x, y)
    t.fillcolor('#000000')
    t.begin_fill()
    t.seth(300)
    t.circle(-100, 30)
    t.seth(35)
    t.circle(300, 15)
    t.circle(30, 50)
    t.seth(190)
    t.circle(300, 17)
    t.end_fill()


def body(self):
    t = self.t

    t.fillcolor('#F6D02F')
    t.begin_fill()
    # 右脸轮廓
    t.penup()
    t.circle(130, 40)
    t.pendown()
    t.circle(100, 105)
    t.left(180)
    t.circle(-100, 5)

    # 右耳朵
    t.seth(20)
    t.circle(300, 30)
    t.circle(30, 50)
    t.seth(190)
    t.circle(300, 36)

    # 上轮廓
    t.seth(150)
    t.circle(150, 70)
    
    # 左耳朵
    t.seth(200)
    t.circle(300, 40)
    t.circle(30, 50)
    t.seth(20)
    t.circle(300, 35)
    #print(t.pos())

    # 左脸轮廓
    t.seth(240)
    t.circle(105, 95)
    t.left(180)
    t.circle(-105, 5)

    # 左手
    t.seth(210)
    t.circle(500, 18)
    t.seth(200)
    t.fd(10)
    t.seth(280)
    t.fd(7)
    t.seth(210)
    t.fd(10)
    t.seth(300)
    t.circle(10, 80)
    t.seth(220)
    t.fd(10)
    t.seth(300)
    t.circle(10, 80)
    t.seth(240)
    t.fd(12)
    t.seth(0)
    t.fd(13)
    t.seth(240)
    t.circle(10, 70)
    t.seth(10)
    t.circle(10, 70)
    t.seth(10)
    t.circle(300, 18)

    t.seth(75)
    t.circle(500, 8)
    t.left(180)
    t.circle(-500, 15)
    t.seth(250)
    t.circle(100, 65)

    # 左脚
    t.seth(320)
    t.circle(100, 5)
    t.left(180)
    t.circle(-100, 5)
    t.seth(220)
    t.circle(200, 20)
    t.circle(20, 70)

    t.seth(60)
    t.circle(-100, 20)
    t.left(180)
    t.circle(100, 20)
    t.seth(300)
    t.circle(10, 70)

    t.seth(60)
    t.circle(-100, 20)
    t.left(180)
    t.circle(100, 20)
    t.seth(10)
    t.circle(100, 60)

    # 横向
    t.seth(180)
    t.circle(-100, 10)
    t.left(180)
    t.circle(100, 10)
    t.seth(5)
    t.circle(100, 10)
    t.circle(-100, 40)
    t.circle(100, 35)
    t.left(180)
    t.circle(-100, 10)

    # 右脚
    t.seth(290)
    t.circle(100, 55)
    t.circle(10, 50)

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以戳这里获取

  1. t.left(180)
    t.circle(100, 10)
    t.seth(5)
    t.circle(100, 10)
    t.circle(-100, 40)
    t.circle(100, 35)
    t.left(180)
    t.circle(-100, 10)

    右脚

    t.seth(290)
    t.circle(100, 55)
    t.circle(10, 50)

[外链图片转存中…(img-HbAhNi1k-1715530097706)]
[外链图片转存中…(img-q5Euv8tS-1715530097707)]
[外链图片转存中…(img-Vpu18oLg-1715530097707)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以戳这里获取

  • 20
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
`__do_softirq` 是一个内核函数,用于处理软断(softirq)。下面是每一行的解释: ```c notrace void __do_softirq(void) ``` 这是函数的声明,表示这是一个无返回值的函数,同时也禁止对该函数进行跟踪。 ```c struct softirq_action *h; unsigned long flags; ``` 定义了两个变量,`h` 是一个指向 `softirq_action` 结构体的指针,`flags` 是一个无符号长整型数。 ```c local_irq_save(flags); ``` 保存当前断状态并关闭断。 ```c __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); ``` 禁用软断。 ```c h = softirq_vec; ``` 将 `softirq_vec` 赋值给变量 `h`,`softirq_vec` 是一个 `softirq_action` 类型的数组,存储了系统支持的软断处理函数。 ```c do { ``` 开始一个循环。 ```c struct softirq_action *this = READ_ONCE(*h); ``` 将 `h` 指向的地址处的值读取出来,赋值给变量 `this`。`READ_ONCE` 是一个宏,用于安全地读取一个变量的值。 ```c if (this) { ``` 判断 `this` 是否为空。 ```c this->action(this); ``` 如果不为空,则执行 `this` 存储的函数指针,也就是调用该软断的处理函数。 ```c } else { ``` 如果为空,则说明该软断处理函数已经被移除,跳过本次循环。 ```c h++; ``` 指向下一个 `softirq_action` 结构体。 ```c } while (this); ``` 循环直到 `this` 为空。 ```c local_bh_enable(); ``` 启用软断。 ```c local_irq_restore(flags); ``` 恢复原来的断状态。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值