The example of this article tells the Wxpython window Chinese garbled solution, shares for everybody reference. The specific methods are as follows:
File Save As Utf-8
The beginning of the file add #-*-Coding:utf-8-*-
Add u or u before having Chinese string, for example: U "my website: http://www.jb51.net"
Examples are as follows:
Copy Code code as follows:
#-*-Coding:utf-8-*-
Import WX
Class App (WX. APP):
def OnInit (self):
frame = wx. Frame (Parent=none, Title=u ' My site: http://www.jb51.net ')
Frame. Show ()
Return True
App = App ()
App. Mainloop ()
Unicode string:
Unicode is the standard way to write international text. If you want to write text in your native language such as Hindi or Arabic, you need an editor that supports Unicode. Similarly, Python allows you to process Unicode text-you just prefix the string with u or U. For example, U "This is a Unicode string.".
Also remember to use a Unicode string when you are working on a text file, especially if you know that the file contains text written in a non-English language.
I hope this article will help you with your Python programming.