tkinter代码里面的 调试好久没成功
没想到这个错误真的无语了 可以参考youtube
def my_udp(*args):
try:
con = mdb.connect('localhost', 'root',
'root', 'tianqi');
cur = con.cursor()
# sql = "INSERT INTO tianqi(`qu`, `haoma`) VALUES (%s, %s)"
# sql = "INSERT INTO tianqi(`qu`, `haoma`) VALUES (%s, %s)"
sql = "SELECT DISTINCT xiang from shengfen where sheng ="+"'"+str(sel.get())+"'"
cur.execute(sql)
rs = cur.fetchall()
xiang_list.clear()
for item in rs:
xiang_list.append(str(item[0]))
con.commit()
except:
print("执行语句错误")
finally:
if con:
# 无论如何,连接记得关闭
con.close()
cb2['values'] = xiang_list
#这一句 一直提示赋值错误 盯着代码看半天,才发现。。。
cb1 = Combobox(root, values=sheng_list,textvariable=sel).pack()
cb2 = Combobox(root,values=xiang_list).pack()
应该把cb1 和 cb2 的pack方法去掉
print("test")