鱼C论坛

 找回密码
 立即注册
查看: 3081|回复: 8

[作品展示] 用Canvas绘制哆啦A梦

[复制链接]
发表于 2020-11-29 15:27:31 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. from tkinter import *

  2. root = Tk()

  3. #画板
  4. paint = Canvas(root, width=600, height=600, background="white")
  5. paint.pack()

  6. #头
  7. paint.create_oval(175, 100, 425, 350, fill="#1E90FF")

  8. #脸
  9. paint.create_oval(200, 150, 400, 350, fill="white")

  10. #眼睛
  11. paint.create_oval(250, 120, 300, 180, fill="white")
  12. paint.create_oval(300, 120, 350, 180, fill="white")
  13. paint.create_oval(280, 140, 295, 160, fill="black")
  14. paint.create_oval(305, 140, 320, 160, fill="black")
  15. paint.create_oval(285, 145, 290, 155, fill="white")
  16. paint.create_oval(310, 145, 315, 155, fill="white")

  17. #鼻子
  18. paint.create_oval(290, 167, 310, 189, fill="red")
  19. paint.create_line(300, 190, 300, 270, fill="black")

  20. #嘴巴
  21. paint.create_arc(240, 230, 360, 270, style=ARC, extent=-180)

  22. #右边胡子
  23. paint.create_line(320, 210, 380, 185)
  24. paint.create_line(320, 220, 385, 220)
  25. paint.create_line(320, 230, 380, 250)

  26. #左边胡子
  27. paint.create_line(280, 210, 220, 185)
  28. paint.create_line(215, 220, 280, 220)
  29. paint.create_line(220, 250, 280, 230)

  30. #身体
  31. paint.create_rectangle(200, 300, 400, 485, fill="#1E90FF")

  32. #肚子
  33. paint.create_oval(230, 285, 370, 425, fill="white")
  34. paint.create_arc(230, 285, 370, 425, outline="white", width=2,
  35.                  start=54, extent=73, style=ARC)

  36. #项圈
  37. paint.create_line(200, 300, 400, 300, capstyle=ROUND, width=15, fill="red")

  38. #铃铛
  39. paint.create_oval(285, 300, 317, 332, fill="yellow")
  40. paint.create_line(286, 312, 316, 312, capstyle=ROUND)
  41. paint.create_line(285, 316, 316, 316, capstyle=ROUND)
  42. paint.create_oval(295, 320, 305, 328, fill="red")
  43. paint.create_line(300, 327, 300, 332)

  44. #口袋
  45. paint.create_arc(246, 300, 354, 410, extent=-180)

  46. #脚
  47. paint.create_arc(280, 465, 322, 504, extent=180,fill="white", outline="white")
  48. paint.create_oval(190, 470, 290, 500, fill="white")
  49. paint.create_oval(310, 470, 410, 500, fill="white")

  50. #左手
  51. lpoints = [200, 306,
  52.            125, 365,
  53.            145, 395,
  54.            200, 372]
  55. paint.create_polygon(lpoints, fill="#1E90FF")
  56. paint.create_oval(114, 356, 160, 402, fill="white")

  57. #右手
  58. rpoints = [401, 306,
  59.            477, 365,
  60.            445, 395,
  61.            401, 372]
  62. paint.create_polygon(rpoints, fill="#1E90FF")
  63. paint.create_oval(440, 355, 487, 402, fill="white")

  64. mainloop()
复制代码


截图:
QQ图片20201129152608.png

评分

参与人数 3荣誉 +6 鱼币 +6 收起 理由
青松100 + 1 + 1 无条件支持楼主!
糖逗 + 5
昨非 + 5 鱼C有你更精彩^_^

查看全部评分

小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-11-29 22:42:33 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-12-1 14:36:55 | 显示全部楼层
哈哈,有意思
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-2 12:15:11 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-12-5 16:52:17 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-12-5 16:58:20 | 显示全部楼层
太厉害了。这个算法是咋搞出来的?
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-7 14:12:45 | 显示全部楼层
青松100 发表于 2020-12-5 16:58
太厉害了。这个算法是咋搞出来的?

用python的Canvas(画布)弄的
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 1 反对 0

使用道具 举报

发表于 2020-12-7 14:15:12 | 显示全部楼层
荔枝葡萄 发表于 2020-12-7 14:12
用python的Canvas(画布)弄的

谢谢指导
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-13 22:12:52 From FishC Mobile | 显示全部楼层
新人报到进来看看
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-30 13:58

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表