首页 > 解决方案 > 如何使用 SimpleGraphics 的用户输入绘制形状?

问题描述

from SimpleGraphics import *
f = open("shape.txt","w")
print("Please provide the necessary information below.")
while (True):
    s=input("please select one of following shapes (line, rect, elipse or quit): ")
    if s=="line":
      f.write(s+"\n")
      y=float(input("please enter you Y value: "))
      f.write(str(y)+"\n")
      x=float(input("please enter you X value: "))
      f.write(str(x)+"\n")
      h=float(input("please enter the value for the height: "))
      f.write(str(h)+"\n")
      w=float(input("please enter the value for the width: "))
      f.write(str(w)+"\n")
      c=input("please enter the colour: ")
      f.write=(c+"\n")
      print(h)
    if s=="quit":
     break
f.close()

标签: python

解决方案


推荐阅读