Python development _ tkinter _ menu options switch between Chinese and English _ menu options unavailable operations _ blog recommendations

Source: Internet
Author: User

My python version is 3.3.2.

If you do not know much about the menu operations of the tkinter module in python, you can see:

If you know some tkinter menu operations, this blog may be helpful to you:

Running effect:

:

You only need to modify the following code to implement conversion between Chinese and English:

                    MENU_BAR =         MENU_FILE_ITEMS =         MENU_EDIT_ITEMS =              MENU_BAR =         MENU_FILE_ITEMS =         MENU_EDIT_ITEMS = EN_EDIT_MENU_ITEMS

    tkinter  *                                  = { :                 :                 :                 :                 :     FLAG = MENU_BAR = MENU_FILE_ITEMS = MENU_EDIT_ITEMS =   CN_MENU_ITEMS = [,  EN_MENU_ITEMS = [,    CN_FILE_MENU_ITEMS = [, ,  EN_FILE_MENU_ITEMS = [, ,    CN_EDIT_MENU_ITEMS = [, , ,  EN_EDIT_MENU_ITEMS = [, , ,             FLAG =                                   MENU_BAR =         MENU_FILE_ITEMS =         MENU_EDIT_ITEMS =              MENU_BAR =         MENU_FILE_ITEMS =         MENU_EDIT_ITEMS =  root =  root.geometry( root.title( root.iconname(       (       (                file_item = Menubutton(menu_bar, text=MENU_BAR[0], underline=     file_item.pack(side=LEFT, padx=     file_item.menu =      file_item.menu.add_command(label=MENU_FILE_ITEMS[0], underline=0, command=     file_item.menu.add_command(label=MENU_FILE_ITEMS[1], underline=0, command=     file_item.menu.add_command(label=MENU_FILE_ITEMS[2], underline=0, command=     file_item[] =                      edit_item = Menubutton(menu_bar, text=MENU_BAR[1], underline=1     edit_item.pack(side=LEFT, padx=     edit_item.menu =          edit_item.menu.add(, label=     edit_item.menu.entryconfig(1, state=      edit_item.menu.add_command(label=MENU_EDIT_ITEMS[1     edit_item.menu.add_command(label=MENU_EDIT_ITEMS[2     edit_item.menu.add_command(label=MENU_EDIT_ITEMS[3     edit_item[] =       menu_bar = Frame(root, relief=RAISED, borderwidth=2 menu_bar.pack(fill=   file_meun = edit_menu =     root.mainloop()

References:

Http://www.oschina.net/code/explore/Python-3.1.3/Demo/tkinter/matt/menu-simple.py

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.