I am new to Python. As an exercise of it, I try to port a program which was
written more than 10 years ago. This program use the Borland C++ Builder as its
GUI front end and a DLL does the real work(it will takes a few seconds to
complete). I saw a strange phenomenon in the following codes. The
"var_status.set('Download...')" statement seems was deferred and didn't show up
until the external DLL job was finished and I can only saw the result of
"var_status.set('Download OK')" statement which immediately follows. I try to
do the DLL function in a thread(selected by using the "test" flag in codes),
but it didn't help.
Can anyone tell me what's the point I was missed?
-------------------------
def download():
global iniFilename
if test: global result, busy
ini = iniFilename
iniFilename = "c:\\$$temp.in3"
saveIniFile()
iniFilename = ini
#do the rest
var_status.set('Download...')
if not test:
result = mydll.SayHello()
else:
busy = True
_thread.start_new_thread(td_download, ())
while busy: pass
if result:
var_status.set("Download Fail at %s" % hex(result))
showerror('Romter', 'Download Fail')
else:
var_status.set('Download OK')
showinfo('Romter', 'Download OK')
if test:
result = 0x5555
busy = True
def td_download():
global busy, result
result = mydll.SayHello()
busy = False
--------------------------
Best Regards,
Jach
--
https://mail.python.org/mailman/listinfo/python-list