Jython

时间:2016-10-14 11:47:21

标签: python jython jes

我一直在为学生尝试使用Jython Environment进行镜像分配。

我正在寻求请求用户使用任意线来镜像图像,这条线必须是从图像边缘到边缘并且是对角线。

def userCoordinates():
  pic = makePicture(pickAFile())
  height = getHeight(pic)
  width = getWidth(pic)
  newPic = makeEmptyPicture, (width, height)

startX = requestInteger("Please enter your startX Coordinate")
while startX > width:
  startX = requestInteger("Error, this coordinate is outside the image, please enter your startX Coordinate") 
else:
  print "Your startX coordinate is", startX

startY =  requestInteger("Please enter your startY Coordinate")
while startY > height:
  startY = requestInteger("Error, this coordinate is outside the image, please enter your startY Coordinate")
else:
  print "Your startY coordinate is", startY

endX =  requestInteger("Please enter your endX Coordinate")
while endX > width:
  endX = requestInteger("Error, this coordinate is outside the image, please enter your endX Coordinate")
else:
  print "Your endX coordinate is", endX

endY =  requestInteger("Please enter your endY Coordinate")
while endY > height:
  endY = requestInteger("Error, this coordinate is outside the image, please enter your endY Coordinate")
else:
  print "Your endY coordinate is", endY

有没有办法验证所选的点是否在图像的边缘?或者更好(更清洁的方式)在上面做。我是各方面的初学者。

我尝试使用startX!= 0或startX!= width

但是这不会起作用,因为X确实可以是任何东西

非常感谢任何帮助!

0 个答案:

没有答案