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


Python Engine.translate方法代码示例

本文整理汇总了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())
开发者ID:jacobj10,项目名称:PyEnigma,代码行数:37,代码来源:enigmaX.py

示例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()
开发者ID:EtienneDesticourt,项目名称:Simple-3D-Engine,代码行数:33,代码来源:main.py


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