根据给定的建议编码后获取错误

时间:2016-10-15 14:11:06

标签: python python-2.7 tkinter

我写了以下代码

class pass_check(ABC):
from Tkinter import *
def __init__(self):
   #------------------------------------------------------------------------
    self.check=Tk()
    self.user=''
    ABC.__init__(self)
    self.pass_key=StringVar()
    self.E=Entry(self.check, bd=2, textvariable=self.pass_key)
    self.E.place(x=0, y=0)
    self.B=Button(self.check, text="Accept", command=self.check_pass(self.pass_key))
    self.B.place(x=50, y=50)
    self.check.mainloop()
def check_pass(fx):
    n=fx.get()
    if n=="25":
        print "Thank u"
    else:
        print "Incorrect"       


if __name__ == "__main__":
    pass_check()

但我得到以下错误无法理解如何摆脱它们,

SyntaxWarning: import * only allowed at module level

Traceback (most recent call last):

  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1322, in configure
    return self._configure('configure', cnf, kw)
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1313, in _configure
    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
TclError: image "pyimage1" doesn't exist

任何人都可以帮助我

0 个答案:

没有答案