我是Centos7.2的系统 python版本是2.7.5
错误提示:
Traceback (most recent call last):
File "./py020.py", line 14, in <module>
'min':2, 'max':12})
File "/usr/lib/python2.7/site-packages/Pmw/Pmw_1_3_3/lib/PmwCounter.py", line 126, in init
self.initialiseoptions()
File "/usr/lib/python2.7/site-packages/Pmw/Pmw_1_3_3/lib/PmwBase.py", line 594, in initialiseoptions
'" for ' + self.__class__.__name__
KeyError: 'Unknown option "extryfield_validate" for Counter'
源码如下
from Tkinter import Button, END, Label, W
from Pmw import initialise, ComboBox, Counter
top = initialise()
lb = Label(top, text='Animals (in pairs; min: pair, max: dozen)')
lb.pack()
ct = Counter(top, labelpos=W,label_text='Number:',
datatype='integer', entryfield_value=2,
increment=3, extryfield_validate={'validate':'integer',
'min':2, 'max':12})
ct.pack()
cb = ComboBok(top,labelpos=W,label_text='Type:')
for animal in ('dog', 'cat', 'hamster', 'python'):
cb.insert(end, animal)
cb.pack()
qb = Button(top,text+'QUIT',
command = top.quit, bg = 'red', fg = 'white')
qb.pack()
top.mainloop()
希望前辈指导一下
报错问题: 未知项extryfield_validate , 仔细看看是不是key写错了。 或者版本问题,extryfield_validate这个key已经没了。
– WrYcF 6年前