Log errors in the tkloop exception handler - right now you don't know if the call to topleveldo failed (it probably did). The problem is that (1) (resultlist)
is just resultlist, not a tuple with 1 argument like topleveldo expects. And (2) tkloop only puts a response if the 4th parameter in the message is a queue. You can fix it with:
self.q.put((self.topleveldo,(resultlist,),{},self.q1))
Added:
tkloop should always return a message, even if it caught an exception, so that callers can reliably call q.get() to get a response. One way to do this is to return the exception that the called program raised:
def tkloop(self):
while True:
try:
f, a, k, qr = self.q.get_nowait()
print f
r = f(*a,**k)
if qr:
qr.put(r)
del f,a,k,qr
except Exception, e:
if qr:
try:
qr.put(e)
except:
# log it
pass
self.okno.after(100, self.tkloop)