本文整理汇总了Python中engine.Engine.toString方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.toString方法的具体用法?Python Engine.toString怎么用?Python Engine.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类engine.Engine
的用法示例。
在下文中一共展示了Engine.toString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EnigmaX
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import toString [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())