本文整理汇总了Python中engine.Engine.translate方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.translate方法的具体用法?Python Engine.translate怎么用?Python Engine.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类engine.Engine
的用法示例。
在下文中一共展示了Engine.translate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EnigmaX
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import translate [as 别名]
class EnigmaX():
def __init__(self):
self.builder = Gtk.Builder()
self.builder.add_from_file(gtk_builder_file)
self.engine = Engine()
self.window = self.builder.get_object('windowMain')
self.textBox = self.builder.get_object('entry')
self.label = self.builder.get_object('label')
self.label2 = self.builder.get_object('enigma')
self.engineToString()
self.textBox.connect('activate', self.signal_text_activate)
self.textBox.connect('changed', self.signal_text_changed)
self.window.connect('destroy', self.signal_window_destroy)
self.ciphertext = ''
self.window.show_all()
def signal_window_destroy(self, _):
self.window.destroy()
Gtk.main_quit()
def signal_text_activate(self, *args):
self.label.set_text(self.engine.run(self.textBox.get_text()))
self.engineToString()
def signal_text_changed(self, *args):
newChar = self.textBox.get_text()[-1] if len(self.textBox.get_text()) else ''
self.ciphertext += self.engine.translate(newChar.upper())
self.label.set_text(self.ciphertext)
self.engineToString()
def engineToString(self):
self.label2.set_text(self.engine.toString())
示例2: Flocker
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import translate [as 别名]
F = Flocker()
#Gen 3D data (cube)
points = []
spacing = 20
for x in range(-8, 8, 2):
for y in range(-8, 8, 2):
for z in range(1):
points.append(((x+1)*spacing, (y+1)*spacing+1, z))
points = np.array(points)
#Project it on 2D plane and move origin to center of screen
projected = E.project(points)
projected = E.translate(projected, 320)
R.points = points#projected
D = Distortion(np.array([[20,20,5]]), 30)
#Render and handle events
R.start()
F.start(points)
endRun = False
space = points
while not endRun:
R.points = F.space#E.translate(E.project(F.space), 320)
for event in pygame.event.get():
if event.type == QUIT:
R.stop()