|
|
@ -1,12 +1,12 @@
|
|
|
|
import tkinter as tk
|
|
|
|
import tkinter as tk
|
|
|
|
from tkinter import ttk, messagebox
|
|
|
|
from tkinter import ttk, messagebox
|
|
|
|
import pymysql
|
|
|
|
import pymysql
|
|
|
|
from 主页面 import MainPage
|
|
|
|
#from 主页面 import MainPage
|
|
|
|
|
|
|
|
|
|
|
|
class JiaJuPage:
|
|
|
|
class JiaJuPage:
|
|
|
|
def __init__(self, master):
|
|
|
|
def __init__(self, master):
|
|
|
|
self.root = master
|
|
|
|
self.root = master
|
|
|
|
self.root.title("智能家居系统 - 家居信息")
|
|
|
|
self.root.title("智能家居系统 - 家居管理")
|
|
|
|
self.root.geometry('1000x700')
|
|
|
|
self.root.geometry('1000x700')
|
|
|
|
|
|
|
|
|
|
|
|
self.conn = pymysql.connect(host='localhost', user='root', password='LH20021212', db='智能家居系统',
|
|
|
|
self.conn = pymysql.connect(host='localhost', user='root', password='LH20021212', db='智能家居系统',
|
|
|
@ -54,7 +54,7 @@ class JiaJuPage:
|
|
|
|
tk.Button(button_frame, text="删除选中", command=self.delete_selected_jiaju).pack(side=tk.LEFT, padx=10)
|
|
|
|
tk.Button(button_frame, text="删除选中", command=self.delete_selected_jiaju).pack(side=tk.LEFT, padx=10)
|
|
|
|
tk.Button(button_frame, text="修改选中", command=self.update_selected_jiaju_popup).pack(side=tk.LEFT, padx=10)
|
|
|
|
tk.Button(button_frame, text="修改选中", command=self.update_selected_jiaju_popup).pack(side=tk.LEFT, padx=10)
|
|
|
|
tk.Button(button_frame, text="查询所有", command=self.query_all_jiaju).pack(side=tk.LEFT, padx=10)
|
|
|
|
tk.Button(button_frame, text="查询所有", command=self.query_all_jiaju).pack(side=tk.LEFT, padx=10)
|
|
|
|
tk.Button(button_frame, text="返回主页面", command=self.return_to_MainPage).pack(side=tk.LEFT, padx=10)
|
|
|
|
tk.Button(button_frame, text="返回主页面", command=self.query_all_jiaju).pack(side=tk.LEFT, padx=10)
|
|
|
|
|
|
|
|
|
|
|
|
query_frame = tk.Frame(self.root)
|
|
|
|
query_frame = tk.Frame(self.root)
|
|
|
|
query_frame.pack(pady=(10, 0)) # 添加一些垂直间隔
|
|
|
|
query_frame.pack(pady=(10, 0)) # 添加一些垂直间隔
|
|
|
@ -231,18 +231,6 @@ class JiaJuPage:
|
|
|
|
self.conn.close()
|
|
|
|
self.conn.close()
|
|
|
|
self.root.destroy()
|
|
|
|
self.root.destroy()
|
|
|
|
|
|
|
|
|
|
|
|
def return_to_main_page(self):
|
|
|
|
|
|
|
|
# 关闭当前家居信息页面的数据库连接(如果之前没有在其他地方关闭)
|
|
|
|
|
|
|
|
self.close_conn()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 销毁当前家居信息窗口
|
|
|
|
|
|
|
|
self.root.destroy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 实例化并运行主页面(这将覆盖当前窗口)
|
|
|
|
|
|
|
|
root = tk.Tk()
|
|
|
|
|
|
|
|
app = MainPage(root)
|
|
|
|
|
|
|
|
root.mainloop()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
root = tk.Tk()
|
|
|
|
root = tk.Tk()
|
|
|
|