[英]Refreshing of value changes for the information displayed within a Text field of Tkinter
我有一个代码,它从文件中读取数值和表名,并逐步将其与来自数据库的另一个值进行比较,以计算多个表中每个表的行数,并写入多行文本<\/strong><\/em>字段这些值是否匹配。
到目前为止一切都很好,但问题是 GUI 冻结并且匹配结果不会打印出来,直到每个表的所有查询都完成。
但是,我需要在完成每个查询后打印每个结果。 例如。 如何在操作期间提供同步
相关代码块
root = Tk()
T = Text(root,height = 14,width = 100,bg="ghostwhite")
...
with open(data_source.get(),'r') as f:
for line in f:
s = line.strip().split('/')
for j in s:
fc = #the numeric value is extracted here
tb = #the table name is extracted here
...
T.insert(END, t)
cur.execute('SELECT COUNT(*) FROM '+tb)
d=cur.fetchone()[0]
if int(dc)!=int(fc):
T.insert(END,' Error! Table count of : '+tb+'; is '+str(dc)+' on DB ,and is '+str(fc)+' in the file\n')
else:
T.insert(END, ' No problem for the table...\n')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.