本文整理匯總了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"
示例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