热爱python,热爱生活,python需要浪漫,让我带大家走进浪漫的国度...写的不好的地方请大佬指教

import turtle
import time class Rose: def __init__(self):
self.interface() @classmethod
def interface(cls):
print('你喜欢玫瑰吗?')
lst = ['喜欢','不喜欢']
for index,hobby in enumerate (lst,1):
print(index,hobby)
while True:
try:
usr = int(input('请输入序号: ').strip())
if usr == 1:
print('你的选择是明智的')
cls.get_color()
break
else:
exit('再见')
except(ValueError,IndexError):
print('输入有误,请重新输入') @staticmethod
def get_rose(flower_color,leaf_color):
turtle.penup()
turtle.left(90)
turtle.fd(200)
turtle.pendown()
turtle.right(90)
turtle.fillcolor(flower_color)
turtle.begin_fill()
turtle.circle(10, 180)
turtle.circle(25, 110)
turtle.left(50)
turtle.circle(60, 45)
turtle.circle(20, 170)
turtle.right(24)
turtle.fd(30)
turtle.left(10)
turtle.circle(30, 110)
turtle.fd(20)
turtle.left(40)
turtle.circle(90, 70)
turtle.circle(30, 150)
turtle.right(30)
turtle.fd(15)
turtle.circle(80, 90)
turtle.left(15)
turtle.fd(45)
turtle.right(165)
turtle.fd(20)
turtle.left(155)
turtle.circle(150, 80)
turtle.left(50)
turtle.circle(150, 90)
turtle.end_fill()
turtle.left(150)
turtle.circle(-90, 70)
turtle.left(20)
turtle.circle(75, 105)
turtle.setheading(60)
turtle.circle(80, 98)
turtle.circle(-90, 40)
turtle.left(180)
turtle.circle(90, 40)
turtle.circle(-80, 98)
turtle.setheading(-83)
turtle.fd(30)
turtle.left(90)
turtle.fd(25)
turtle.left(45)
turtle.fillcolor(leaf_color)
turtle.begin_fill()
turtle.circle(-80, 90)
turtle.right(90)
turtle.circle(-80, 90)
turtle.end_fill()
turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)
turtle.right(90)
turtle.right(45)
turtle.fillcolor(leaf_color)
turtle.begin_fill()
turtle.circle(80, 90)
turtle.left(90)
turtle.circle(80, 90)
turtle.end_fill()
turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200, 60)
turtle.done() @staticmethod
def choose_color(color_table):
while True:
try:
for index, color in enumerate(color_table, 1):
print(index, color)
Silly_guy = int(input('请输入序号: ').strip())
break
except (ValueError, IndexError):
print('你输入的有误,请重新输入')
return color_table[Silly_guy - 1] @classmethod
def get_color(cls):
print('欢迎来到选花环节')
time.sleep(1)
print('那就先选择花花的颜色吧')
bingo = cls.flower()
print(f'好了花花的颜色是{bingo}')
time.sleep(1)
print('请选择叶子的颜色')
yoyo = cls.flower()
print(f'叶子的颜色是{yoyo}')
print('快去看看吧')
cls.get_rose(bingo,yoyo) @classmethod
def flower(cls):
Bekir = 'green|red|pink|black|purple|yellow|cyan'
color_table = Bekir.split('|')
ret = cls.choose_color(color_table)
return ret Rose()

最新文章

  1. webView和js交互
  2. useful tips for win7--close the noise volume(关掉win7开机、系统操作的声音)
  3. WebStorm9
  4. RESTful登录设计(基于Spring及Redis的Token鉴权)
  5. C#当前应用程序路径及环境变量
  6. 当前标识(NT AUTHORITY\NETWORK SERVICE)没有对“C:\WINDOWS2\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files”的写访问权限。
  7. CentOS6.4下搭建hadoop2.2(64bit)注意事项
  8. php 不能同时提交form
  9. The mmap module
  10. mouse的各种事件
  11. Blend4 的安装和配置
  12. 字符串(String)
  13. SUCTF 2016 : dMd
  14. java线程池的实现机制
  15. linux时区和时间设置
  16. Python flask+react+antd实现登陆demo
  17. SPFA最短路算法
  18. [转]使用mysql profiles 来查看sql 语句执行计划
  19. 课堂练习Complex类
  20. hdu 5651 xiaoxin juju needs help 逆元 两种求解方式

热门文章

  1. ui-router 1.0 001 - resolve, component, sref-active
  2. V-rep学习笔记:机器人路径规划2
  3. testng.xml 配置大全
  4. 使用EF操作不同数据库(以SQLite为例)
  5. Android在开发中的使用技巧之解决ScrollView嵌套RecyclerView出现的系列问题
  6. 3D打印技术之切片引擎(5)
  7. ES6,Array.copyWithin()函数的用法
  8. 【emWin】例程十六:窗口管理器
  9. jstack 命令的使用和堆栈分析
  10. 教程:Spagobi开源BI系统 Console报表设计教程