使用 Python 与 RAYZ

Drew Perttula 的 Python 网格方块程序(称为 creategrid)定义了封套图像的部分,这些部分在水中看起来会分解。当封套破碎时,图像会在 RAYZ 中经历扭曲和其他变形。Python 程序的文本输出被粘贴到 RAYZ 中,但不是你可能期望的那样粘贴到文本框中。“RAYZ 的巧妙之处在于它允许我从任何地方粘贴文本到它的 GUI 中,并且粘贴的结果是实际的 GUI 节点和连接”,Perttula 说。

#!/usr/bin/python

import pygame, pygame.image
from pygame.locals import *

pygame.init()

white = [255]*3
surf = pygame.Surface( (600,350), SWSURFACE )

xcells=6
ycells=4

for xi in range(0,xcells):
   for yi in range(0,ycells):

      surf.fill( 0 )
      surf.fill( white,
         Rect([[xi*1.0/xcells*600,yi*1.0/ycells*350],
              [600.0/xcells,350.0/ycells]]) )

      filebase = "grid%02i-%02i" % (xi,yi)
      pygame.image.save(surf, filebase+".bmp" )

      print """
"%s" = imagein(  )
{
  full.file_info.file_id: "fish/%s.bmp";
  full.flip: 0;
  user_size.width ( !user_set ): 600;
  user_size.height ( !user_set ): 350;
  add_alpha: 1;
  sequence_range: undefined 0.5@0.5 linear
                  1000.5@1000.5 undefined;
}""" % ( filebase, filebase )

It outputs this, 24 times, with varying names
(instead of grid00-00):

"grid00-00" = imagein(  )
{
  full.file_info.file_id:
    "/40g/video/fish/grid00-00.bmp";
  full.flip: 0;
  user_size.width ( !user_set ): 600;
  user_size.height ( !user_set ): 350;
  add_alpha: 1;
  sequence_range: undefined 0.5@0.5 linear
                  1000.5@1000.5 undefined;
}
© . All rights reserved.