我有段代码总是报错,求教各位大神,谁能帮忙解决下啊.报错为: cu.execute('select * from ID_state where State="在线"')
sqlite3.OperationalError: no such table: ID_state
import tkinter
from tkinter import *
from tkinter import ttk
import os
import tkinter.messagebox
import sqlite3
import os.path
class Main():
def __init__(self):
self.ruku()
def ruku(self):
self.root = tkinter.Tk()
self.root.title('入库')
screewidth = self.root.winfo_screenwidth()
screeheight = self.root.winfo_screenheight()
root_width = screewidth - 50
root_height = 650
x = int((screewidth - root_width) / 2)
y = int((screeheight - root_height) / 2)
self.root.geometry('{}x{}+{}+{}'.format(root_width, root_height, x, y))
self.root.config(bg='#87CEEB')
mainmenu = Menu(self.root,tearoff= False)
mainmenu.add_command(label='返回主菜单')
mainmenu.add_command(label='退出')
self.root.config(menu= mainmenu)
Label(self.root,text='入库作业',font=("微软雅黑",20),fg= "grey",bg='#87CEEB').pack()#place(x=screewidth/2,y=0)
Label(self.root, text='项', font=("微软雅黑", 20), fg="grey",bg='#87CEEB').place(x=10,y=40)
Label(self.root, text='1', font=("微软雅黑", 20), fg="grey",bg='#87CEEB').place(x=10, y=75)
Label(self.root, text='入库类别', font=("微软雅黑", 20), fg="grey",bg='#87CEEB').place(x=70, y=40)
self.value_D_01 = StringVar()
self.value_D_01.set("采购入库")
values1 = ['采购入库', '验收入库', '上级下发入库','其它入库']
self.combobox1 = ttk.Combobox(
master=self.root, # 父容器
height=10, # 高度,下拉显示的条目数量
width=8, # 宽度
state="readonly", # 设置状态 normal(可选可输入)、readonly(只可选)、 disabled
cursor="arrow", # 鼠标移动时样式 arrow, circle, cross, plus...
font=("微软雅黑", 15), # 字体
textvariable=self.value_D_01, # 通过StringVar设置可改变的值
values=values1, # 设置下拉框的选项
justify='center'
)
self.combobox1.place(x=60, y=75)
Label(self.root, text="入库编号", font=("微软雅黑", 15), fg="grey",bg='#87CEEB').place(x=280, y=40)
self.D_ID = []
conn = sqlite3.connect("./ID_state.db")
cu = conn.cursor()
cu.execute('select * from ID_state where State="在线"')
E = cu.fetchall()
conn.commit()
cu.close
for i in range(len(E)):
self.D_ID.append(E[i][4])
self.value_D_02 = StringVar()
self.value_D_02.set("")
self.combobox2 = ttk.Combobox(
master=self.root, # 父容器
height=10, # 高度,下拉显示的条目数量
width=20, # 宽度
state="normal", # 设置状态 normal(可选可输入)、readonly(只可选)、 disabled
cursor="arrow", # 鼠标移动时样式 arrow, circle, cross, plus...
font=("微软雅黑", 15), # 字体
textvariable=self.value_D_02, # 通过StringVar设置可改变的值
values=self.D_ID, # 设置下拉框的选项
justify='center'
)
self.combobox2.place(x=190, y=75)
self.root.mainloop()
main = Main()