本文整理汇总了Python中World.World.stepBackward方法的典型用法代码示例。如果您正苦于以下问题:Python World.stepBackward方法的具体用法?Python World.stepBackward怎么用?Python World.stepBackward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World.World
的用法示例。
在下文中一共展示了World.stepBackward方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BeeForm
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import stepBackward [as 别名]
#.........这里部分代码省略.........
except Exception as e:
self.logline("\nFailed to load " + name + ".py")
self.logline(self.exception2str(e) + "\n")
def preparetheworld(self):
if self.checkbeearguments():
self.world = World(self.selectedbeeclass,
self.amountofbees,
self.widthofworld,
self.heightofworld,
self.beearguments.copy(),
self.worldseed)
self.view.startworldwidth = self.widthofworld
self.view.startworldheight = self.heightofworld
self.view.reset(self.world)
self.updatetime()
self.updateDrawingArea()
self.setupcomlist()
def startstop(self):
if self.world is not None:
if not self.running:
self.running = True
timeout_add(self.runworldinterval, self.runWorld)
else:
self.running = False
def stepback(self):
if self.world is not None:
if self.world.currentState > 0:
self.running = False
self.world.stepBackward()
self.updateDrawingArea()
self.updateComlist()
self.updatebeedebug()
self.updatetime()
def stepforward(self):
if self.world is not None:
self.running = False
self.world.stepForward()
self.updateDrawingArea()
self.updateComlist()
self.updatebeedebug()
self.updatetime()
def updatetime(self):
text = str(self.world.currentState) + " / " + str(self.world.totalStates)
self.timelabel.set_text(text)
def setupcomlist(self):
position = 0
if self.comlist.get_n_columns() > 0:
for i in reversed(range(0,self.comlist.get_n_columns())):
self.comlist.remove_column(
self.comlist.get_column(i))
columns = ["Position","Awake"]
if self.selectedbeeclass is not None:
if self.selectedbeeclass.comkeys() is not None:
columns = columns + self.selectedbeeclass.comkeys()