当前位置: 首页>>代码示例>>Python>>正文


Python Window.refresh方法代码示例

本文整理汇总了Python中Window.refresh方法的典型用法代码示例。如果您正苦于以下问题:Python Window.refresh方法的具体用法?Python Window.refresh怎么用?Python Window.refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Window的用法示例。


在下文中一共展示了Window.refresh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Vec2

# 需要导入模块: import Window [as 别名]
# 或者: from Window import refresh [as 别名]
Window.init(PixelMathBridge())

size = Vec2(100,100)
canvas = Window(size)
pmOpenImage(canvas.id,"archery.jpg")


def neighboring(position):
    yield position.plus(Vec2(-1,-1))
    yield position.plus(Vec2(-1,0))
    yield position.plus(Vec2(-1,1))
    yield position.plus(Vec2(0,-1))
    #yield position.plus(Vec2(0,0))
    yield position.plus(Vec2(0,1))
    yield position.plus(Vec2(1,-1))
    yield position.plus(Vec2(1,0))
    yield position.plus(Vec2(1,1))

for pos in canvas.positions():
    for neighbor in neighboring(pos):
        if neighbor.y < size.y and neighbor.x < size.x and neighbor.y >0 and neighbor.x >0:
            current = canvas.getColor(pos)
            next    = canvas.getColor(neighbor)
            if current.equals(next):
                canvas.setColor(pos,Color.RED)
                break

canvas.refresh()
print "done"

开发者ID:TyOverby,项目名称:PixelMath-Shim,代码行数:31,代码来源:arch.py

示例2: refresh

# 需要导入模块: import Window [as 别名]
# 或者: from Window import refresh [as 别名]
    def refresh(self, id):
        return pmUpdateDisplay(int(id))
Window.init(PixelMathBridge())

def inBounds(bounds, position):
    return position.x <= bounds.x and position.y <= bounds.y

size = Vec2(500.0,500.0)
middle = size.scaled(0.5)
canvas = Window(size)

others = []
for pixel in canvas.pixels():
    bright = random.randrange(0,255)
    pixel.setColor(Color(bright,bright,bright))
canvas.refresh()

for i in range(2,50,2):
    new = pmNewImage(i, str(i), int(size.x), int(size.y), 255,0,0)
    others.append(new)
    pmSetSource1(canvas.id)
    pmSetDestination(new)
    newRelSize = int(min(size.y,size.x)/i)
    offset = random.randrange(0,min(size.x,size.y)-newRelSize)
    pmSetFormula("s1(x/"+str(i)+"+"+str(offset)+",y/"+str(i)+"+"+str(offset)+")")
    pmCompute()

final = Window(size)
for pixel in final.pixels():
    pos = pixel.position
    value = 0
开发者ID:TyOverby,项目名称:PixelMath-Shim,代码行数:33,代码来源:nice-cloud.py


注:本文中的Window.refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。