python实现图书管理系统,图形化界面版

有GUI,但未连数据库

# 图书管理系统UI界面
import wx
import datetime
class wxGUI(wx.App):
    # 登陆界面
    
    def Login(self):
        self.frame_Login = wx.Frame(None, title="Login", size=(500, 300))
        self.panel_Login = wx.Panel(self.frame_Login, -1)
        self.label1      = wx.StaticText(self.panel_Login, -1, \
            '欢迎来到图书管理系统', pos=(100,60),style=wx.ALIGN_CENTER)
        font=wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
        self.label1.SetFont(font)
        # Combobox1--选择身份
        self.label2=wx.StaticText(self.panel_Login,-1,'Identify',pos=(0,100),style=wx.ALIGN_LEFT)
        self.identify={
   '管理员':["管理员"],'学生':['112','113']}
        self.combobox1=wx.ComboBox(self.panel_Login,value="Click here",\
            choices=list(self.identify.keys()),pos=(100,100),size=(100,30))
        self.Bind(wx.EVT_COMBOBOX,self.Oncombo1,self.combobox1)

        #用户名
        self.label3=wx.StaticText(self.panel_Login,-1,'Student Number',\
            pos=(0,120),style=wx.ALIGN_LEFT)
        self.combobox2=wx.ComboBox(self.panel_Login,value="Click here",\
            choices=[],pos=(100,120),size=(100,30))
        self.Bind(wx.EVT_COMBOBOX,self.Oncombo2,self.combobox2)

        #密码
        self.label4=wx.StaticText(self.panel_Login,-1,'Password',\
            pos=(0,140),style=wx.ALIGN_LEFT)
        self.textpasswd = wx.TextCtrl(self.panel_Login, -1, \
            pos=(100, 145), size=(100, 20), style=wx.TE_PASSWORD)        

        self.button_paswd = wx.Button(self.panel_Login, -1, 'OK', pos=(160, 200))
        self.Bind(wx.EVT_BUTTON, self.OnButton_paswd, self.button_paswd)
        self.button_paswd.SetDefault()
        self.frame_Login.Show()

    def Oncombo1(self,event):
        shenfen=self.combobox1.GetValue() #返回切换按钮的状态(开/关
        self.combobox2.Set(self.identify[shenfen])

    def Oncombo2(self,event):
        wx.MessageBox(self.combobox2.GetValue())   

    #校验用户名与密码
    def OnButton_paswd(self, event):
        userName = self.combobox2.GetValue()
        userPassword = self.textpasswd.GetValue()
        if userName == "管理员" and userPassword == "123456":
            wx.MessageBox("密码正确")
            self.Management_Menu()
        elif (userName == "112" and userPassword=="123") \
            or (userName=="113"and userPassword=="345"):
            wx.MessageBox("密码正确")
            self.Student_Menu()            
        else:
            wx.MessageBox("密码或用户名错误")


#管理员界面

    def Management_Menu<
  • 36
    点赞
  • 365
    收藏
    觉得还不错? 一键收藏
  • 19
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值