关于Python IDLE Unicode与kivy

时间:2016-11-10 09:05:19

标签: python encoding kivy

我正在处理需要某种韩语的应用程序。 我设置了字体根,但在使用IDLE运行时仍然会出现编码错误。

我该如何解决? ex39.py代码

from kivy.uix.widget import Widget
from kivy.uix.behaviors import DragBehavior
from kivy.app import App
from kivy.properties import StringProperty

class Horse(DragBehavior,Widget):
    horse_state=StringProperty('Not Dragging')
    def on_touch_move(self,touch):
        tx,ty = touch.pos
        sx,sy = self.pos
        if sx+52>=tx>sx+36 and sy+53>=ty>sy+28:
            self.horse_state = 'Dragging'
        return super(Horse, self).on_touch_move(touch)

class Ex39(Widget):
    pass

class Ex39App(App):
    def build(self):
        return Ex39()

if __name__=='__main__':
    Ex39App().run()

ex39.kv文件代码

<Horse>:
    size: 100,74
    drag_rectangle: self.x+36, self.y+28, 16, 25
    drag_timeout: 10000000
    drag_distance: 0
    on_touch_up: self.horse_state = 'Not Dragging'
    canvas:
        Rectangle:
            pos: self.pos
            size: self.size
            source: 'horse.png'

<Ex39>:
    canvas:
        Color:
            rgb: 1,1,1,1
        Rectangle:
            size: root.width,root.height
            pos: 0,0
    Label:
        font_name: 'C:\Python34\H2GTRE.TTF'
        pos: 300,root.top-100
        text:
            ('[size=32][color=CC8811]'
            '음표의 길이 익히기'
            '[/color][/size]')
        markup: True
    Horse:
        id: horse_id
        pos: root.width/2.5,root.height/2
    Label:
        pos: 300,100
        text:
            ('[size=32][color=CC8811]'+
            horse_id.horse_state+
            '[/color][/size]')
        markup: True

错误消息:   UnicodeDecodeError:&#39; cp949&#39;编解码器无法解码位置608中的字节0xec:非法多字节序列

0 个答案:

没有答案