s数据库GUI
2021/12/12 19:20:10
本文主要是介绍s数据库GUI,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
import wx import sqlite3 #嵌入信息库 #conn = sqlite3.connect('student information') #cursor = conn.cursor() #cursor.execute('insert into user (id,name,sr) values ("310143122","aaa","20021209")') #cursor.execute('insert into user (id,name,sr) values ("310143123","bbb","20011106")') #cursor.close() #conn.commit() #conn.close() class MyFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, '用户登录', size=(400, 300)) # 创建面板 panel = wx.Panel(self) # 创建”确定“和”取消“按键,并绑定事件 self.bt_confirm = wx.Button(panel, label='确定') self.bt_confirm.Bind(wx.EVT_BUTTON, self.OnclickSubmit) self.bt_cancel = wx.Button(panel, label='取消') self.bt_cancel.Bind(wx.EVT_BUTTON, self.OnclickCancel) # 创建文本,左对齐 self.title = wx.StaticText(panel, label="请输入用户名和密码") self.label_user = wx.StaticText(panel, label='用户名') self.text_user = wx.TextCtrl(panel, style=wx.TE_LEFT) self.label_pwd = wx.StaticText(panel, label='密 码') self.text_password = wx.TextCtrl(panel, style=wx.TE_PASSWORD) # 添加容器,容器中控件横向排列 hsizer_user = wx.BoxSizer(wx.HORIZONTAL) hsizer_user.Add(self.label_user, proportion=0, flag=wx.ALL, border=5) hsizer_user.Add(self.text_user, proportion=1, flag=wx.ALL, border=5) hsizer_pwd = wx.BoxSizer(wx.HORIZONTAL) hsizer_pwd.Add(self.label_pwd, proportion=0, flag=wx.ALL, border=5) hsizer_pwd.Add(self.text_password, proportion=1, flag=wx.ALL, border=5) hsizer_button = wx.BoxSizer(wx.HORIZONTAL) hsizer_button.Add(self.bt_confirm, proportion=0, flag=wx.ALIGN_CENTER, border=5) hsizer_button.Add(self.bt_cancel, proportion=0, flag=wx.ALIGN_CENTER, border=5) # 添加容器,容器中的控件纵向排列 vsizer_all = wx.BoxSizer(wx.HORIZONTAL) vsizer_all.Add(self.title, proportion=0, flag=wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER, border=15) vsizer_all.Add(hsizer_user, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=45) vsizer_all.Add(hsizer_pwd, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=45) vsizer_all.Add(hsizer_button, proportion=0, flag=wx.ALIGN_CENTER | wx.TOP, border=15) panel.SetSizer(vsizer_all) def OnclickSubmit(self, event): message = [] username = self.text_user.GetValue() password = self.text_password.GetValue() if username == '' and password == '': message = '用户名或密码不能为空' elif username == 'aaa' and password == '310143122': message = '姓名:aaa \n学号:310143122' else : message = "用户名跟密码不匹配" wx.MessageBox(message) def OnclickCancel(self,event): self.text_user.SetValue("") self.text_password.SetValue("") if __name__ == '__main__': app = wx.App() frame = MyFrame(parent=None, id=-1) frame.Show() app.MainLoop()
这篇关于s数据库GUI的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-11有哪些好用的家政团队管理工具?
- 2025-01-11营销人必看的GTM五个指标
- 2025-01-11办公软件在直播电商前期筹划中的应用与推荐
- 2025-01-11提升组织效率:上级管理者如何优化跨部门任务分配
- 2025-01-11酒店精细化运营背后的协同工具支持
- 2025-01-11跨境电商选品全攻略:工具使用、市场数据与选品策略
- 2025-01-11数据驱动酒店管理:在线工具的核心价值解析
- 2025-01-11cursor试用出现:Too many free trial accounts used on this machine 的解决方法
- 2025-01-11百万架构师第十四课:源码分析:Spring 源码分析:深入分析IOC那些鲜为人知的细节|JavaGuide
- 2025-01-11不得不了解的高效AI办公工具API