tanmoklepasha

geo_typing

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