from tkinter import *
root = Tk()
root.title("End of year exam")
score = 0
def submit_button_clicked():
global score
global questions
score = 0
if answer.get() == questions[0][1]:
score+=1
else:
score = score
scoretxt.config(text = "Your score is: {}".format(str(score)))
questions =[("What does 13 + 5 = ?","18"),("What does 12 + 8 = ?","20"),("What does 19 + 6 = ?","25"),("What does 17 + 15 = ?","32")]
Label(root,text = "Question : ",bg ="light grey").grid(row = 0,column = 0, sticky = W)
question=Label(root,bg = "light green",text= questions[1][0], width = 38)
question.grid(row =1,column=0)
Label(root,text = "Answer: ",bg = "light grey").grid(row = 2, column = 0, sticky = W)
answer = Entry(root,bg ="white",width = 45, justify = CENTER)
answer.grid(row = 3,column=0)
scoretxt = Label(root,text ="Your score is:",bg = "light green", width = 38)
scoretxt.grid(row = 10,column = 0, sticky = W)
### make a submit button
Button(root,text= "Submit",bg = "light grey",command = submit_button_clicked).grid(row = 4,column = 0, sticky = W)
root.mainloop()
我一直收到错误func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
let cell: UITableViewCell = UITableViewCell(style: <#T##UITableViewCellStyle#>.Subtitle, reuseIdentifier: "test")
。
我也收到错误editor placeholder in source file
。
答案 0 :(得分:0)
你的文件中有一个编辑器占位符(编译器非常好地指出了它)。将错误行更改为:
let cell: UITableViewCell = UITableViewCell(style: .Subtitle, reuseIdentifier: "test")