0

I wish to create a unicode editor in an Indian Language(Malayalam) . I have a set of unicode letters for Malayalam language. But my requirement is, I need to enter only malayalam characters in a wx.TextCtrl. I am able to write a dictionary mapping file for the malayalam letters which maps the unicode conversion for the letters we enter through keyboard. I am able to generate corresponding malayalam letters also successfully. But I am unaware of how to display it on the screen. My code is as below.

def conv(self, event):
    keycode = event.GetKeyCode()
    event.Skip()

    if keycode == wx.WXK_SPACE: 
    #if 0 < keycode <= 256:
        key = chr(keycode)
        self.word += key    
        text = self.text.GetRange(0, self.text.GetInsertionPoint())#check the code here
        wordlist = text.split(' ')
        cur_word = ' ' + wordlist[-1]       ## cur_word = current word
        sow = text.rfind(' ')


        if sow == -1:               ## you are at the start of document, so remove the initial space
            sow = 0
            cur_word = cur_word[1:]

        if not self.convert.IsChecked():

            self.text.Replace(sow, self.text.GetInsertionPoint(), engine.roman2mal(cur_word))#.decode('utf-8')) )

    event.Skip()

The function engine.roman2mal(cur_word) will successfully return the corresponding Malayalam Language character. My only requirement is I need to display it on my textCtrl. Please help me to solve the issue. The code is explained as like this : The code uses phonetic way of writing Malayalam Language. After typing English letters and press space, all the English letters will be converted to corresponding letter in Malayalam Language. Kindly help me how can I arrange my textCtrl code to display whatever the engine() function returns on screen..I am getting wrong somewhere on the code.. !! Kindly suggest me...

Corley Brigman
  • 11,633
  • 5
  • 33
  • 40
archana
  • 9
  • 3
  • 1
    you should post your error. and, if you're using wxpython 2.8 or previous, are you using the unicode build? – Corley Brigman Feb 07 '14 at 18:58
  • Why do you have "if NOT self.convert.IsChecked()" ? It sounds like this could be as simple as your logic there is inverted. Surely you want to do that Replace() if the "convert" IsChecked()? – GreenAsJade Feb 09 '14 at 06:29

0 Answers0