在 【Python作品分享】for_set_expanse 2.0【作品秀】 中回复
回OOOOOOOOOOOOOOOOOOO:
import turtle as t
class Setup():
def __init__(self):
pass
def setup(speed:int,pensize:int,bgcolor:str,pencolor:str,fillcolor:str,screen_width:int,screen_hight:int,hide:int):
t.speed(int(speed))
t.pensize(int(pensize))
t.bgcolor(str(bgcolor))
t.pencolor(str(pencolor))
t.fillcolor(str(fillcolor))
t.screensize(int(screen_width), int(screen_hight))
if hide==0:
t.hideturtle()
elif hide==1:
t.showturtle()
if __name__=="__main__":
Setup.setup(0,3,"black","white","white",400,400,0)
t.done()
你把这个复制后用set这个名称保存下来与这个代码文件放同一个文件夹试试
或者用这个试试:
import turtle as t
class setExpanse(): def set_ex(): bgcolor = t.textinput('write your backgroudcolor', 'write your backgroudcolor(string)[you have to write by yourself]') pencolor = t.textinput('write your pencolor', 'write your pencolor(string)[you have to write by yourself]') fillcolor = t.textinput('write your fillcolor', 'write your fillcolor(string)[you have to write by yourself]') y_n = t.textinput('Do you want to hide the turtle', 'Do you want to hide the turtle(yes/no)') pensize = t.numinput('write your pensize', 'wirte your pensize(must be num)[be careful if you want to set the high num]') pen_speed = t.numinput('write the speed of your pen', 'wirte the speed of your pen(must be num)[I hope you can choose from 0 to 3]')
if y_n == "yes"or y_n == "y": y_n = 0 elif y_n == "no"or y_n == "n": y_n = 1
hide = y_n t.speed(int(pen_speed)) t.pensize(int(pensize)) t.bgcolor(str(bgcolor)) t.pencolor(str(pencolor)) t.fillcolor(str(fillcolor)) t.screensize(400, 400) if hide == 0: t.hideturtle() elif hide == 1: t.showturtle()
if __name__ == "__main__": setExpanse.set_ex() t.done()
2021-08-09T20:30:08 点赞:0