我一直在使用相同的Python / Tkinter代码一周,而且看似无处不在我收到错误“Bad label specification”:
Traceback (most recent call last):
File "C:/Users/shapirju/Desktop/NumericalAnalysis-Project2/gui.py", line 1188, in <module>
gui = App()
File "C:/Users/shapirju/Desktop/NumericalAnalysis-Project2/gui.py", line 62, in __init__
self.createWidgets()
File "C:/Users/shapirju/Desktop/NumericalAnalysis-Project2/gui.py", line 70, in createWidgets
self.interpLabelframe = LabelFrame(self.root, text = "Interpolation", labelanchor=N)
File "C:\Program Files\Python27\lib\lib-tk\ttk.py", line 776, in __init__
Widget.__init__(self, master, "ttk::labelframe", kw)
File "C:\Program Files\Python27\lib\lib-tk\ttk.py", line 555, in __init__
Tkinter.Widget.__init__(self, master, widgetname, kw=kw)
File "C:\Program Files\Python27\lib\lib-tk\Tkinter.py", line 2096, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: Bad label anchor specification 443664640LN
这是由行self.interpLabelframe = LabelFrame(self.root, text = "Interpolation", labelanchor=N)
由于这在几个小时前起作用,也许这是一个环境问题?我在Google上找不到关于此问题的任何内容。
答案 0 :(得分:0)
将其更改为self.interpLabelframe = LabelFrame(self.root, text = "Interpolation", labelanchor='n')
可解决问题。
根据LabelFrame
的{{3}},标签锚定义为字符串'n'
,'we'
等。