My first landing interface:
The import tkinter
The import tkinter. Messagebox
Root=tkinter. Tk ()
Root. Title (' students' course selection management system ')
Root [' height ']=330
Root [' width ']=450
LabelName=tkinter. Label (root, text='user name:' the justify=tkinter. RIGHT, width=80)
LabelName. Place (=10 x, y=5, width=80, height=20)
VarName=tkinter. StringVar (root, value=' ')
EntryName=tkinter. Entry (root, width=80, textvariable=varName)
EntryName. Place (x=100, y=5, width=80, height=20)
LabelPwd=tkinter. Label (root, text='secret code:' the justify=tkinter. RIGHT, width=80)
LabelPwd. Place (x=10, y=30, width=80, height=20)
VarPwd=tkinter. StringVar (root, value=' ')
EntryPwd=tkinter. Entry (root, show='*', width=80, textvariable=varPwd)
EntryPwd. Place (x=100, y=30, width=80, height=20)
Def the login () :
Name=entryName. The get ()
The PWD=entryPwd. The get ()
If name=='admin' and PWD=='123456' :
Tkinter. Messagebox. Showinfo (title='congratulations' message=' login successfully! ')
The else:
Tkinter. Messagebox. Showerror (' warning 'message=' user name or password error)
ButtonOk=tkinter. Button (root, text='login', the command=login)
ButtonOk. Place (=30 x, y=70, width=50, height=20)
Def the cancel () :
VarName. Set (')
VarPwd. Set (')
ButtonCancel=tkinter. Button (root, text='cancel', the command=cancel)
ButtonCancel. Place (x=90, y=70, width=50, height=20)
Root. Mainloop ()
My main interface:
The import sqlite3
Conn=sqlite3. Connect (" D: 123123 db ")
Print (" database connection success!" );
Print (" t \ \ t address book management ")
While True:
Print (" 1. New ", end=' ')
Print (" 2. Search ", end=' ')
Print (" 3. Add ", end=' ')
Print (" 4. Changes ", end=' ')
Print (" 5. Delete ", end=' ')
Print (" 6. Sort ", end=' ')
Print (" 0. Exit ", end=' ')
Choice=int (input (" please input your choice (0 ~ 7) "))
If (choice==0) :
break;
If (choice<0 or choice> 7) :
Print (" input is illegal, please input again!" )
The continue
If (choice==1) :
Conn. Execute (" 'the CREATE TABLE MYADDRESS
(ID INT PRIMARY KEY NOT NULL,
The NAME TEXT NOT NULL,
TELEPHONE TEXT NOT NULL,
EMAIL TEXT,
ADDRESS TEXT,
WEICHART TEXT,
QQ TEXT); "')
Print (" successfully established contacts database table!" )
Elif (choice==2) :
,,,,,,,,,
,,,,,,,,,
Then don't know how to connect, solving solution!