鱼C论坛

 找回密码
 立即注册
查看: 1872|回复: 3

tkinter从一个界面跳转到另一个界面遇到了问题

[复制链接]
发表于 2019-9-18 13:52:15 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
我在跳转到新界面并关闭旧界面的时候会多出现一个空白的界面,这是为什么呀 捕获.PNG
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2019-9-18 13:58:42 | 显示全部楼层
代码呢
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-9-18 14:07:47 | 显示全部楼层

from tkinter import *
from SQLserver import *
from student_surface import *

def test():
    def redestroy(sno,sname):
        a=sno
        b=sname
        surface(a,b)
   
    def log():
        
        a=Tk()
        a.iconbitmap('.//ganda.ico')
        a.title('学生管理系统')
        msg=SQLServer(server="localhost",user="MADAO",password="mayixiang",database="test05")
        sql='select * from syuser'
        result = msg.ExecQuery(sql)
        d=0
        for row in result:
            if(e1.get()==row[0].rstrip()):
                cipher=row[3].rstrip()
                c=row[4]
                d=1
                break
            elif(row[1].rstrip()==e1.get()):
                cipher=row[3].rstrip()
                c=row[4]
                d=1
                break
            elif(row[2].rstrip()==e1.get()):
                cipher=row[3].rstrip()
                c=row[4]
                d=1
                break
        if d==0:
            Label(a,text='账号错误!').pack()
            Button(a,text='确认',width=10,command=a.destroy).pack()
            e2.delete(0,len(e2.get()))
        elif d==1:
            if c==1:
                if cipher==e2.get():
                    sql2='select sname from student where sno=%s'%e1.get()
                    result2=msg.ExecQuery(sql2)
                    for row2 in result2:
                        sname=row2[0]
                    
                    redestroy(e1.get(),sname)
                    root.destroy()
                    
                else:
                    
                    Label(a,text='密码错误!').pack()
                    Button(a,text='确认',width=10,command=a.destroy).pack()
                    e2.delete(0,len(e2.get()))

        a.mainloop()
    root=Tk()
    root.iconbitmap('.//ganda.ico')
    root.title('学生管理系统')

    v1=StringVar()
    v2=StringVar()

    Label(root,text='账号:').grid(row=0,column=0)
    Label(root,text='密码:').grid(row=1,column=0)

    e1=Entry(root,textvariable=v1)
    e2=Entry(root,textvariable=v2,show='*')

    e1.grid(row=0,column=1,padx=10,pady=5)
    e2.grid(row=1,column=1,padx=10,pady=5)

    Button(root,text='登入',width=10,command=log).grid(row=3,column=0,sticky=W,padx=10,pady=5)
    Button(root,text='退出',width=10,command=root.destroy).grid(row=3,column=1,sticky=E,padx=10,pady=5)
   

    root.mainloop()



if __name__=="__main__":
        test()
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-9-18 14:08:38 | 显示全部楼层

from tkinter import *
from SQLserver import *
from log_in import *
from student_surface import *

def surface(sno,sname):



    root1=Tk()
    root1.iconbitmap('.//ganda.ico')
    root1.title('***********学生管理系统(学生模式)************')
   
   
    group=LabelFrame(root1,text='用户',padx=5,pady=5)
    group.grid(row=0,column=0)

    Label(group,text='姓名:'+sname).pack(anchor=W)
    Label(group,text='账号:'+sno).pack(anchor=W)
    Button(group,text='注销',width=10,command=root1.destroy).pack()
    Button(group,text='修改密码',width=10).pack()



    group2=LabelFrame(root1,text='请选择你的操作',padx=5,pady=5)
    group2.grid(row=1,column=0)

    Button(group2,text='查询',width=10).pack()
    Button(group2,text='修改',width=10).pack()
    Button(group2,text='增加',width=10).pack()
    Button(group2,text='删除',width=10).pack()

if __name__=="__main__":
        surface('0','0' )
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-1-19 10:31

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表