有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<