def runscan(self):
p = os.popen('LD_PRELOAD=/usr/libv4l/v4l1compat.so zbarcam
/dev/video0','r')
while True :
code = p.readline().split(':')[1]
print 'Got barcode:', code
def input(self):
self.entryc.insert(END, code)
这是怎么回事?我想使用本地'代码'到下一个函数将条形码的结果插入我的Tkinter entryBox ..谢谢
答案 0 :(得分:0)
将其作为参数传递。将input
的定义更改为def input(self, code)
,然后将runscan
调用input(code)
的最后一行更改为input
。请注意,您不应该使用&#34;输入&#34;作为函数的名称,因为它会影响内置的<img>
函数,该函数用于从控制台获取用户输入。