简体   繁体   English

未使用的变量“按钮”pylint(未使用的变量)

[英]Unused variable 'buttons' pylint(unused-variable)

I am working on creating a simple Tic-Tac-Toe game, through tkinter module.我正在通过 tkinter 模块创建一个简单的井字游戏。 And there seems to be a而且似乎有一个
Unused variable 'buttons' pylint(unused-variable)未使用的变量“按钮”pylint(未使用的变量)
in the following part of my code:在我的代码的以下部分:

buttons=tk.StringVar()

    def btnClick(buttons):
        nonlocal bclick,p1Name,p2Name,p1,p2,flag
        if buttons["text"] == " " and bclick == True:
            buttons["text"] = "X"
            bclick = False
            p1 = p1Name.get() + " Wins!"
            win_check()
            flag = flag+1
        elif buttons["text"] == " " and bclick == False:
            buttons["text"] = "O"
            bclick = True
            p2 = p2Name.get() + " Wins!"
            win_check()
            flag = flag+1
        else:
            showinfo("Tic-Tac-Toe", "Button already Clicked!")

Please note that the above code is inside a method, thus the indentation.请注意,上面的代码在方法内部,因此是缩进。

I am working on creating a simple Tic-Tac-Toe game, through tkinter module.我正在通过 tkinter 模块创建一个简单的井字游戏。 And there seems to be a而且似乎有一个
Unused variable 'buttons' pylint(unused-variable)未使用的变量“按钮”pylint(未使用的变量)
in the following part of my code:在我的代码的以下部分:

buttons=tk.StringVar()

    def btnClick(buttons):
        nonlocal bclick,p1Name,p2Name,p1,p2,flag
        if buttons["text"] == " " and bclick == True:
            buttons["text"] = "X"
            bclick = False
            p1 = p1Name.get() + " Wins!"
            win_check()
            flag = flag+1
        elif buttons["text"] == " " and bclick == False:
            buttons["text"] = "O"
            bclick = True
            p2 = p2Name.get() + " Wins!"
            win_check()
            flag = flag+1
        else:
            showinfo("Tic-Tac-Toe", "Button already Clicked!")

Please note that the above code is inside a method, thus the indentation.请注意,上面的代码在方法内部,因此是缩进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM