Advertisement
tanmoklepasha

typing_geo

Dec 4th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. from tkinter import *
  2. root=Tk()
  3. root.geometry("400x300")
  4.  
  5. def translit1(text):
  6.  
  7.     abc={'h': 'ჰ', 'S': 'შ', 'z': 'ზ',
  8.          'f': 'ფ', 'C': 'ჩ', 'W': 'ჭ',
  9.          'y': 'ყ', 'r': 'რ','c': 'ც',
  10.          's': 'ს', 'a': 'ა', 't': 'ტ',
  11.          'v': 'ვ', 'x': 'ხ','g': 'გ',
  12.          'T': 'თ','l': 'ლ', 'u': 'უ',
  13.          'm': 'მ','k': 'კ', 'i': 'ი',
  14.          'd': 'დ', 'J': 'ჟ', 'b': 'ბ',
  15.          'j': 'ჯ', 'o': 'ო', 'Z': 'ძ',
  16.          'w': 'წ', 'R': 'ღ', 'p': 'პ',
  17.          'n': 'ნ', 'q': 'ქ', 'e': 'ე'}
  18.  
  19.     ka_text= abc[text]
  20.     return ka_text
  21.  
  22. def translite(event):
  23.     if "A"<=event.char<="Z" or "a"<=event.char<="z":
  24.         global i
  25.         word=e.get()[-1]
  26.         e.delete(i,last=None)
  27.         e.insert(i, translit1(word))
  28.         i+=1
  29.     elif event.char == " " or event.keysym=="question"or event.keysym =="comma"or event.keysym =="period" :
  30.         i+=1
  31.     elif event.keysym=="BackSpace":
  32.         i-=1
  33.         if i<0:
  34.             i=0
  35. i=0
  36. e=Entry(root,width=50)
  37. e.place(relx=0.1,rely=0.5)
  38. root.bind("<KeyPress>",translite)
  39. root.config(bg="blue")
  40. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement