如何使用Jython

时间:2016-12-11 22:09:54

标签: jython jes

我在完成作业时遇到问题,我绝不会找人为我做作业。我们的教授没有回答或提供足够的资源来解决我们的任务问题。我复制了一个给我们的示例代码,但我无法让它本身运行。

当我运行这个程序时,我在命令行中收到的所有内容都是省略号而没有别的 有没有人知道省略号是什么意思? My code and command line screenshot Screenshot of my example code

附件将是代码:

def encode(msgPic,original):
 # Assume msgPic and original have same dimensions
 # First, make all red pixels even
 for pxl in getPixels(original):
  # Using modulo operator to test oddness
  if (getRed(pxl) % 2) == 1:
   setRed(pxl, getRed(pxl) - 1)
 # Second, wherever there???s black in msgPic
 # make odd the red in the corresponding original pixel
 for x in range(0,getWidth(original)):
  for y in range(0,getHeight(original)):
   msgPxl = getPixel(msgPic,x,y)
   origPxl = getPixel(original,x,y)
   if (distance(getColor(msgPxl),black) < 100.0):
     # It's a message pixel! Make the red value odd.
     setRed(origPxl, getRed(origPxl)+1)

以下是示例提示输入命令行的代码:

- beach = makePicture(getMediaPath("beach.jpg"))  
- explore(beach)"  
- msg = makePicture(getMediaPath("msg.jpg"))  
- encode(msg,beach)  
- explore(beach)  
- writePictureTo(beach,getMediaPath("beachHidden.png"))  

0 个答案:

没有答案