python变量赋值,我可以禁用var吗?

2024-10-02 22:29:24 发布

您现在位置:Python中文网/ 问答频道 /正文

错误:

 UnboundLocalError: local variable 'x' referenced before assignment

x尚未定义。。。你知道吗

我能在buttonaritmetric中禁用x并且只在我给他打电话时启用吗?你知道吗

    buttonAritmethic = (x*imgfW)+buttonCenter, 350

    for x in range(buttonReach):
    self.canvasbackground = self.canvasFrame.create_image(buttonAritmethic, anchor = "nw", image = self.imgf)

Tags: imageselffor定义local错误variableassignment