在wx中显示Unicode字符。python2.7中的TextCtrl

2024-10-05 11:20:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我希望创建一个印度语(马拉雅拉姆语)的unicode编辑器。我有一套马来语的unicode字母。但我的要求是,我只需要在wx.TextCtrl. 我能够为马拉雅拉姆语字母编写一个字典映射文件,它映射我们通过键盘输入的字母的unicode转换。我也能成功地生成相应的马拉雅拉姆语字母。但我不知道如何在屏幕上显示它。我的代码如下。在

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()

功能roman2mal发动机(curêu word)将成功返回相应的马拉雅拉姆语字符。我唯一的要求是我需要在我的textcrl上显示它。请帮我解决这个问题。 代码是这样解释的:代码使用马来语的语音书写方式。输入英文字母并按空格键后,所有英文字母将转换成马来语对应的字母。请帮助我如何安排我的textcrl代码来显示engine()函数在屏幕上返回的内容..我在代码的某个地方出错了!!请建议我。。。在


Tags: the代码textselfeventif屏幕字母

热门问题