olarak ayarlayarak daire yarıçapı oluşturulamıyor Yaptığım dairenin yarıçapını, daha önce yapılmış bir satırın uzunluğundan itibaren 1/4'ü olacak şekilde ayarlamanız gerekir.Bir çizginin uzunluğunu bölerek ve bu alanı
win = GraphWin("Interactive Drawing",300,300)
win.setCoords(0,0,300,300)
##Create instruction to click the corners of the rectangle
instruction1 = Text(Point(104,10), "Click for lower left of rectangle")
instruction1.draw(win)
lowerLeft = win.getMouse()
instruction1.undraw()
instruction2 = Text(Point(100,10), "Click upper right of rectangle")
instruction2.draw(win)
upperRight = win.getMouse()
instruction2.undraw()
##Draw 2 triangles to form a multicolor rectangle from given points
rightX = upperRight.getX()
rightY = upperRight.getY()
leftX = lowerLeft.getX()
leftY = lowerLeft.getY()
leftZ = rightY - leftY
leftB = leftY + leftZ
rightZ = rightY - leftZ
point1 = Point(leftX,leftY)
point2 = Point(leftX,leftB)
point3 = Point(rightX,rightY)
point4 = Point(rightX,rightZ)
leftTriangle = Polygon(point1,point2,point3)
leftTriangle.draw(win)
leftTriangle.setFill("Purple")
rightTriangle = Polygon(point1,point3,point4)
rightTriangle.draw(win)
rightTriangle.setFill("Green")
##Get Circle point from mouse and draw 4 from point
color = Entry(Point(90,30),19)
color.setText("Enter Color Name Here")
color.draw(win)
instruction3 = Text(Point(114,10), "Click location after entering color")
instruction3.draw(win)
circleClick = win.getMouse()
instruction3.undraw()
circleX = circleClick.getX
circleY = circleClick.getY
circleCenter = Point(circleX,circleY)
radius = ((rightY - leftY)/4)
circle1 = Circle(circleCenter, radius)
circle1.draw(win)
circle2 = Circle(300 - circleClick.getX, 300 - circleClick.getY,radius)
circle2.draw(win)
Ben programı çalıştırdığınızda, ben dikdörtgen yapmak mümkün, ama çemberin merkezi olması için fare tıklaması noktası soran ve çizmek çalışırken, ben hatayı olsun
File "C:/Users/Ian/Documents/Python Projects/InputDrawing.py", line 68, in main
circle1 = Circle(circleCenter, radius)
File "C:\Users\Ian\AppData\Local\Programs\Python\Python35-32\lib\graphics.py", line 599, in __init__
p1 = Point(center.x-radius, center.y-radius)
TypeError: unsupported operand type(s) for -: 'method' and 'float'
Daireye dair bir yarıçap elde etmek için bunları birbirine bölünebilen şeylere nasıl değiştireceğimi bilmiyorum. Herhangi bir yardım? (Bu herhangi bir anlam ifade ederse)
Çalıştığınız kitaplığa gerçekten aşina değilim, bu yüzden emin değilim. Çember bir setFill() yöntemine sahip mi? Üçgenlerin rengini ayarlamak için kullandığınız gibi görünüyor. – vtl
Ahh özür dilerim, silindi yorum çünkü anladım. SetFill() öğesinin setFill (color.getText) olarak değiştirilebilmesi gerekiyordu) – LufiaCloud