Wxpython window Chinese Garbled solution method

Source: Internet
Author: User
The example of this article describes the Wxpython window Chinese garbled solution, share for everyone for reference. Here's how:

Save File as Utf-8
Add #-*-Coding:utf-8-*-at the beginning of the file
Add u or u before Chinese string, for example: U "My site: http://www.bitsCN.com"

Examples are as follows:

The code is as follows:

#-*-Coding:utf-8-*-
Import WX
The Class App (WX. APP):

def OnInit (self):
frame = wx. Frame (Parent=none, Title=u ' My site: http://www.bitsCN.com ')
Frame. Show ()
Return True

App = App ()
App. Mainloop ()

Unicode string:

Unicode is the standard method of writing international texts. If you want to write text in your native language, such as Hindi or Arabic, then you need to have a Unicode-enabled editor. Similarly, Python allows you to work with Unicode text-you only need to prefix the string with u or U. For example, U "This is a Unicode string.".

Also remember to use Unicode strings when you are working with text files, especially if you know that the file contains text written in a language other than English.

Hopefully this article will help you with Python programming.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.