Home > other >  For syntax error problem!!!!!!
For syntax error problem!!!!!!

Time:11-12


 # coding: utf-8 

The import Tkinter as tk
The import tkMessageBox as MB

Top=tk. Tk ()

Def buildMenu (parent) :
Menus=((u "file", ((u "new game", evNew),
(u "recovery", evResume),
(u "save", evSave),
(u "exit", evExit)),
(u "help", ((u "help", evHelp),
(u "about", evAbout)))
)
# to build the top-level menu object
Menubar=tk. The Menu (the parent)

For the menu in menus:
# create submenu
M=tk. The Menu (the parent)
For the item in the menu [1] :
Add menu item # to the sub menu
M. dd_command (label=item [0], the command=item [1])
# to the top menu to add submenu (" file "and" help ")
Menubar. Add_cascade (label=menu [0], menu=m)
Return menubar

Def dummy () :
MB. Showinfo (" Dummy ", "the Event to be done")

Ev New=dummy
EvResume=dummy
EvSave=dummy
EvExit=top. Quit
EvHelp=dummy
EvAbout=dummy
# to create menu
Top (" menu ")=mbar
Tk. Mainloop ()





Have been an error in line 17, I a small white one, always can't find where the error is, bosses, please feel free to comment!!!!!!

CodePudding user response:

1. No line 17 has a problem, is a right parenthesis line 15 less

2. In addition, line 32 variables are evNew, there is no space between

Now see these, I machine Tkinter some problems, so can't give you check

  • Related