Exemplo n.º 1
0
 def __init__(self):
     Enigma.__init__(self)
     root = Tk()
     root.title('Enigma Cipher')
     #root.geometry("200x100")
     self.make_widgets()
     self.plain_text.bind("<Key>", self.update)
     root.mainloop()
Exemplo n.º 2
0
Arquivo: gui.py Projeto: chel1k/enigma
    def __init__(self):
        Enigma.__init__(self)
        root = Tk()
        root.title('Enigma Cipher')
        self.keys = [['Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O'],
                    ['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K'],
                    ['P', 'Y', 'X', 'C', 'V', 'B', 'N', 'M', 'L']
                    ]
        self.cipher_message = ''
        self.font = ('courier', 14, 'bold')
        root.bind("<Key-q>", self.on_Q)
        root.bind("<Key-w>", self.on_W)
        root.bind("<Key-e>", self.on_E)
        root.bind("<Key-r>", self.on_R)
        root.bind("<Key-t>", self.on_T)
        root.bind("<Key-z>", self.on_Z)
        root.bind("<Key-u>", self.on_U)
        root.bind("<Key-i>", self.on_I)
        root.bind("<Key-o>", self.on_O)
        root.bind("<Key-a>", self.on_A)
        root.bind("<Key-s>", self.on_S)
        root.bind("<Key-d>", self.on_D)
        root.bind("<Key-f>", self.on_F)
        root.bind("<Key-g>", self.on_G)
        root.bind("<Key-h>", self.on_H)
        root.bind("<Key-j>", self.on_J)
        root.bind("<Key-k>", self.on_K)
        root.bind("<Key-p>", self.on_P)
        root.bind("<Key-y>", self.on_Y)
        root.bind("<Key-x>", self.on_X)
        root.bind("<Key-c>", self.on_C)
        root.bind("<Key-v>", self.on_V)
        root.bind("<Key-b>", self.on_B)
        root.bind("<Key-n>", self.on_N)
        root.bind("<Key-m>", self.on_M)
        root.bind("<Key-l>", self.on_L)
        self.command_mapping = { 'Q': self.on_Q,
                                 'W': self.on_W,
                                 'E': self.on_E,
                                 'R': self.on_R,
                                 'T': self.on_T,
                                 'Z': self.on_Z,
                                 'U': self.on_U,
                                 'I': self.on_I,
                                 'O': self.on_O,
                                 'A': self.on_A,
                                 'S': self.on_S,
                                 'D': self.on_D,
                                 'F': self.on_F,
                                 'G': self.on_G,
                                 'H': self.on_H,
                                 'J': self.on_J,
                                 'K': self.on_K,
                                 'P': self.on_P,
                                 'Y': self.on_Y,
                                 'X': self.on_X,
                                 'C': self.on_C,
                                 'V': self.on_V,
                                 'B': self.on_B,
                                 'N': self.on_N,
                                 'M': self.on_M,
                                 'L': self.on_L }
        self.make_widgets()

        self.Q_light = Label(self.lightboard, bg='black', fg='black', font=self.font,
                          width=2, relief=RIDGE, bd=1, text='Q')
    

        root.mainloop()