未填写的“自我”参数

问题描述 投票:0回答:1

[我正在使用Tkinter编写游戏代码,与按下另一个按钮(按钮B)相比,我需要一个按钮(按钮A)首先处于关闭状态,这是我到目前为止尝试过的。]

def click():   # defines the press of Button B
    p1name = P1.get()
    p2name = P2.get()
    namethanks = 'thank you "' + p1name + ' " you are player 1 (X) \n and thank you "' + p2name +'" you are player 2 (O)'
    namesubmission.insert(END, namethanks)
    realgametime.configure(state=DISABLED,)

然后是代码定义按钮A

realgametime(window, text="play the game", width=13, command=play, bg=bgcolour, fg=fgcolour, state=DISABLED) .grid(row=4, column=1, sticky=W)  # button A

然后这是错误:

enter image description here

请帮助

我正在使用Tkinter编写游戏代码,与按下另一个按钮(按钮B)相比,我需要一个按钮(按钮A)首先关闭,而在这里,按钮A处于打开状态是我到目前为止尝试过的def click(): ...

python button tkinter
1个回答
0
投票

据我了解,您使用过

© www.soinside.com 2019 - 2024. All rights reserved.