激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

腳本之家,腳本語言編程技術(shù)及教程分享平臺!
分類導(dǎo)航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務(wù)器之家 - 腳本之家 - Python - python基于Tkinter實(shí)現(xiàn)人員管理系統(tǒng)

python基于Tkinter實(shí)現(xiàn)人員管理系統(tǒng)

2022-03-07 00:23XL不吃辣 Python

這篇文章主要為大家詳細(xì)介紹了python基于Tkinter實(shí)現(xiàn)人員管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

前言

Tkinter是python內(nèi)置的標(biāo)準(zhǔn)GUI庫,基于Tkinter實(shí)現(xiàn)了簡易人員管理系統(tǒng),所用數(shù)據(jù)庫為Mongodb

代碼

時間寶貴!直接上代碼!

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
from tkinter import *
from tkinter.messagebox import *
from tkinter import ttk
import pymongo
import tkinter as tk
import re
import time
import datetime
 
import pandas as pd
from tkinter import filedialog
from PIL import ImageTk,Image
import tkinter
 
#連接數(shù)據(jù)庫
client = pymongo.MongoClient(host="localhost", port=27017)
db = client.sys
col = db.user
#創(chuàng)建窗口
root = Tk()
root.geometry('900x700')
root.title('人員管理系統(tǒng)')
#表頭
img =Image.open(r'C:\Users\apple\Desktop\image.jpg')
img = img.resize((900,68),Image.ANTIALIAS)
img = ImageTk.PhotoImage(img)
top=Label(root, text='人員管理系統(tǒng)',image=img,fg='black',font=('楷體', 20),compound='center', bitmap='error')
top.pack(ipady=0,side=TOP, fill='x')
#變量
sid = StringVar()
name = StringVar()
age = StringVar()
salary = StringVar()
phone = StringVar()
birthday = StringVar()
 
 
#控制函數(shù)
 
def add():
    global info
    info=Toplevel()
    info.title("添加信息")
    info.geometry('400x400')
    button1=Button(info, text="確認(rèn)",command=appendInfo,font=("黑體", 12)).place(relx=0.4, rely=0.8, width=100)
    Label(info, text="工號:").place(relx=0.2, rely=0.1, relwidth=0.1)
    Label(info, text="姓名:").place(relx=0.2, rely=0.2, relwidth=0.1)
    Label(info, text="年齡:").place(relx=0.2, rely=0.3, relwidth=0.1)
    Label(info, text="薪資:").place(relx=0.2, rely=0.4, relwidth=0.1)
    Label(info, text="電話:").place(relx=0.2, rely=0.5, relwidth=0.1)
    Label(info, text="生日:").place(relx=0.2, rely=0.6, relwidth=0.1)
    text1=Entry(info, textvariable=sid).place(relx=0.3, rely=0.1, relwidth=0.45, height=25)
    sid.set("")
    text2=Entry(info, textvariable=name).place(relx=0.3, rely=0.2, relwidth=0.45, height=25)
    name.set("")
    text3=Entry(info, textvariable=age).place(relx=0.3, rely=0.3, relwidth=0.45, height=25)
    age.set("")
    text4=Entry(info, textvariable=salary).place(relx=0.3, rely=0.4, relwidth=0.45, height=25)
    salary.set("")
    text5=Entry(info, textvariable=phone).place(relx=0.3, rely=0.5, relwidth=0.45, height=25)
    phone.set("")
    text6=Entry(info, textvariable=birthday).place(relx=0.3, rely=0.6, relwidth=0.45, height=25)
    birthday.set("")
    info.bind('<Return>',pas8)
#     info.bind_all('<KeyPress-Up>',movetriangle)
#     info.bind_all('<KeyPress-Down>',movetriangle)
#     info.bind_all('<KeyPress-Left>',movetriangle)
#     .bind_all('<KeyPress-Right>',movetriangle)
    
    
def pitch_on():
    global info
    info=Toplevel()
    info.title("刪除信息")
    info.geometry('400x400')
    Label(info, text="是否確定刪除以下信息",font=('楷體', 15)).place(relx=0.2, rely=0.01, relwidth=0.6)
    Label(info, text="工號:").place(relx=0.2, rely=0.1, relwidth=0.1)
    Label(info, text="姓名:").place(relx=0.2, rely=0.2, relwidth=0.1)
    Label(info, text="年齡:").place(relx=0.2, rely=0.3, relwidth=0.1)
    Label(info, text="薪資:").place(relx=0.2, rely=0.4, relwidth=0.1)
    Label(info, text="電話:").place(relx=0.2, rely=0.5, relwidth=0.1)
    Label(info, text="生日:").place(relx=0.2, rely=0.6, relwidth=0.1)
    text1=Entry(info, textvariable=sid,state='disable').place(relx=0.3, rely=0.1, relwidth=0.45, height=25)
    sid.set(sf[0])
    text2=Entry(info, textvariable=name,state='disable').place(relx=0.3, rely=0.2, relwidth=0.45, height=25)
    name.set(sf[1])
    text3=Entry(info, textvariable=age,state='disable').place(relx=0.3, rely=0.3, relwidth=0.45, height=25)
    age.set(sf[2])
    text4=Entry(info, textvariable=salary,state='disable').place(relx=0.3, rely=0.4, relwidth=0.45, height=25)
    salary.set(sf[3])
    text5=Entry(info, textvariable=phone,state='disable').place(relx=0.3, rely=0.5, relwidth=0.45, height=25)
    phone.set(sf[4])
    text6=Entry(info, textvariable=birthday,state='disable').place(relx=0.3, rely=0.6, relwidth=0.45, height=25)
    birthday.set(sf[5])
    button1=Button(info, text="確認(rèn)",command=deleteInfo).place(relx=0.2, rely=0.8, width=100)
    button2=Button(info, text="關(guān)閉",command=des).place(relx=0.6, rely=0.8, width=100)
    info.bind('<Return>',pas33)
    
def information2():
    global info
    info=Toplevel()
    info.title("詳細(xì)信息")
    info.geometry('400x400')
    button1=Button(info, text="更新信息",command=updateInfo).place(relx=0.4, rely=0.8, width=100)
    Label(info, text="工號:").place(relx=0.2, rely=0.1, relwidth=0.1)
    Label(info, text="姓名:").place(relx=0.2, rely=0.2, relwidth=0.1)
    Label(info, text="年齡:").place(relx=0.2, rely=0.3, relwidth=0.1)
    Label(info, text="薪資:").place(relx=0.2, rely=0.4, relwidth=0.1)
    Label(info, text="電話:").place(relx=0.2, rely=0.5, relwidth=0.1)
    Label(info, text="生日:").place(relx=0.2, rely=0.6, relwidth=0.1)
    text1=Entry(info, textvariable=sid,state='disable').place(relx=0.3, rely=0.1, relwidth=0.45, height=25)
    sid.set(sf[0])
    text2=Entry(info, textvariable=name).place(relx=0.3, rely=0.2, relwidth=0.45, height=25)
    name.set(sf[1])
    text3=Entry(info, textvariable=age).place(relx=0.3, rely=0.3, relwidth=0.45, height=25)
    age.set(sf[2])
    text4=Entry(info, textvariable=salary).place(relx=0.3, rely=0.4, relwidth=0.45, height=25)
    salary.set(sf[3])
    text5=Entry(info, textvariable=phone).place(relx=0.3, rely=0.5, relwidth=0.45, height=25)
    phone.set(sf[4])
    text6=Entry(info, textvariable=birthday).place(relx=0.3, rely=0.6, relwidth=0.45, height=25)
    birthday.set(sf[5])
    info.bind('<Return>',pas11)
    
    
 
def des():
    info.destroy()
    
def information(event):
    item=dataTreeview.selection()
    itemvalues=dataTreeview.item(item,'values')
    global info
    info=Toplevel()
    info.title("詳細(xì)信息")
    info.geometry('400x400')
    button1=Button(info, text="更新信息",command=updateInfo).place(relx=0.4, rely=0.8, width=100)
 
    Label(info, text="工號:").place(relx=0.2, rely=0.1, relwidth=0.1)
    Label(info, text="姓名:").place(relx=0.2, rely=0.2, relwidth=0.1)
    Label(info, text="年齡:").place(relx=0.2, rely=0.3, relwidth=0.1)
    Label(info, text="薪資:").place(relx=0.2, rely=0.4, relwidth=0.1)
    Label(info, text="電話:").place(relx=0.2, rely=0.5, relwidth=0.1)
    Label(info, text="生日:").place(relx=0.2, rely=0.6, relwidth=0.1)
    text1=Entry(info, textvariable=sid,state='disable').place(relx=0.3, rely=0.1, relwidth=0.45, height=25)
    sid.set(itemvalues[0])
    text2=Entry(info, textvariable=name).place(relx=0.3, rely=0.2, relwidth=0.45, height=25)
    name.set(itemvalues[1])
    text3=Entry(info, textvariable=age).place(relx=0.3, rely=0.3, relwidth=0.45, height=25)
    age.set(itemvalues[2])
    text4=Entry(info, textvariable=salary).place(relx=0.3, rely=0.4, relwidth=0.45, height=25)
    salary.set(itemvalues[3])
    text5=Entry(info, textvariable=phone).place(relx=0.3, rely=0.5, relwidth=0.45, height=25)
    phone.set(itemvalues[4])
    text6=Entry(info, textvariable=birthday).place(relx=0.3, rely=0.6, relwidth=0.45, height=25)
    birthday.set(itemvalues[5])
    
def isVaildDate(date):
        try:
            time.strptime(date, "%Y-%m-%d")
            return True
        except:
            return False
        
def showAllInfo():
    x = dataTreeview.get_children()
    for item in x:
        dataTreeview.delete(item)
    lst=col.find({},{'_id':0})
    for item in lst:
        i=list(item.values())
        dataTreeview.insert("", 1, text="line1", values=i)
def pas1(self):
    showAllInfo()
    
def pas2(self):
    add()
    
def pas3(self):
    pitch_on()
 
def pas33(self):
    deleteInfo()
    
def pas4(self):
    information2()
    
def pas5(self):
    searchInfo()
 
def pas55(self):
    search()
    
def pas6(self):
    impInfo()
    
def pas7(self):
    exp()
    
def pas8(self):
    appendInfo()
    
def pas9(self):
    global sf
    sf=dataTreeview.selection()
    sf=dataTreeview.item(sf,'values')
    
def pas10(self):
    expInfo()
    
def pas11(self):
    updateInfo()
    
      
def appendInfo():
    flag=1
    if sid.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if sid.get().isdigit() == False:
        showerror(title='提示', message='格式錯誤')
        sid.set("")
        flag=0
        
    if name.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
        
    if age.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if age.get().isdigit() == False:
        showerror(title='提示', message='格式錯誤')
        age.set("")
        flag=0
    
    if salary.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if salary.get().isdigit() == False:
        showerror(title='提示', message='格式錯誤')
        salary.set("")
        flag=0
        
    if phone.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if phone.get().isdigit() == False:
        showerror(title='提示', message='格式錯誤')
        phone.set("")
        flag=0
    
    if birthday.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if isVaildDate(str(birthday.get())) == False:
        showerror(title='提示', message='格式錯誤')
        birthday.set("")
        flag=0
    if flag==1:
        x = dataTreeview.get_children()
        for item in x:
            dataTreeview.delete(item)
        list1 = {
                "work_number":sid.get(),
                "name":name.get(),
                "age":age.get(),
                "salary":salary.get(),
                "phone":phone.get(),
                "birthday":birthday.get()
            }
        col.insert_one(list1)
        lst=col.find({},{'_id':0})
        for item in lst:
            i=list(item.values())
            dataTreeview.insert("", 1, text="line1", values=i)
        info.destroy()
 
 
def deleteInfo():
    lst=list(col.find({},{'_id':0}))
    num = sid.get()
    flag = 0
    for i in range(len(lst)):
        if str(num)==str(lst[i].get("work_number")):
            flag = 1
            col.delete_one({'work_number':num})
            break
 
    x = dataTreeview.get_children()
    for item in x:
        dataTreeview.delete(item)
 
    lst=col.find({},{'_id':0})
    for item in lst:
        i=list(item.values())
        dataTreeview.insert("", 1, text="line1", values=i)
    info.destroy()
        
#更新操作
def updateInfo():
    sid_1 = sid.get()
    name_1 = name.get()
    age_1 = age.get()
    salary_1 = salary.get()
    phone_1 = phone.get()
    birthday_1 = birthday.get()
    flag=1
    if sid.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if sid.get().isdigit() == False:
        showerror(title='提示', message='格式錯誤')
        sid.set("")
        flag=0
        
    if name.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
        
    if age.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if age.get().isdigit() == False:
        showerror(title='提示', message='格式錯誤')
        age.set("")
        flag=0
    
    if salary.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if salary.get().isdigit() == False:
        showerror(title='提示', message='格式錯誤')
        salary.set("")
        flag=0
        
    if phone.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if phone.get().isdigit() == False:
        showerror(title='提示', message='格式錯誤')
        phone.set("")
        flag=0
    
    if birthday.get() == "":
        showerror(title='提示', message='輸入不能為空')
        flag=0
    if isVaildDate(str(birthday.get())) == False:
        showerror(title='提示', message='格式錯誤')
        birthday.set("")
        flag=0
    if flag==1:
        up={
            "work_number":sid_1,
            "name":name_1,
            "age":age_1,
            "salary":salary_1,
            "phone":phone_1,
            "birthday":birthday_1
        }
 
        old=col.find_one({'work_number': sid_1},{"_id": 0})
        col.update_one(old, {'$set':up})
        x = dataTreeview.get_children()
        for item in x:
            dataTreeview.delete(item)
        lst=col.find({},{'_id':0})
        for item in lst:
            i=list(item.values())
            dataTreeview.insert("", 1, text="line1", values=i)
        showinfo(title='提示', message='更新成功!')
        des()
    
    
#搜索頁面
def search():
    global info
    info=Toplevel()
    info.title("搜索信息")
    info.geometry('400x400')
    button1=Button(info, text="確認(rèn)搜索",command=searchInfo).place(relx=0.4, rely=0.8, width=100)
    Label(info, text="工號:").place(relx=0.2, rely=0.1, relwidth=0.1)
    Label(info, text="姓名:").place(relx=0.2, rely=0.2, relwidth=0.1)
    Label(info, text="年齡:").place(relx=0.2, rely=0.3, relwidth=0.1)
    Label(info, text="薪資:").place(relx=0.2, rely=0.4, relwidth=0.1)
    Label(info, text="電話:").place(relx=0.2, rely=0.5, relwidth=0.1)
    Label(info, text="生日:").place(relx=0.2, rely=0.6, relwidth=0.1)
    text1=Entry(info, textvariable=sid).place(relx=0.3, rely=0.1, relwidth=0.45, height=25)
    sid.set("")
    text2=Entry(info, textvariable=name).place(relx=0.3, rely=0.2, relwidth=0.45, height=25)
    name.set("")
    text3=Entry(info, textvariable=age).place(relx=0.3, rely=0.3, relwidth=0.45, height=25)
    age.set("")
    text4=Entry(info, textvariable=salary).place(relx=0.3, rely=0.4, relwidth=0.45, height=25)
    salary.set("")
    text5=Entry(info, textvariable=phone).place(relx=0.3, rely=0.5, relwidth=0.45, height=25)
    phone.set("")
    text6=Entry(info, textvariable=birthday).place(relx=0.3, rely=0.6, relwidth=0.45, height=25)
    birthday.set("")
    info.bind('<Return>',pas5)
#搜索操作   
def searchInfo():
    lst=list(col.find({},{'_id':0}))
    sid_1 = sid.get()
    name_1 = name.get()
    age_1 = age.get()
    salary_1 = salary.get()
    phone_1 = phone.get()
    birthday_1 = birthday.get()
    flag=1
#     if sid.get().isdigit() == False:
# #         showerror(title='提示', message='格式錯誤')
#         sid.set("")
#         flag=0
#     if age.get().isdigit() == False:
# #         showerror(title='提示', message='格式錯誤')
#         age.set("")
#         flag=0
#     if salary.get().isdigit() == False:
# #         showerror(title='提示', message='格式錯誤')
#         salary.set("")
#         flag=0
        
#     if phone.get().isdigit() == False:
# #         showerror(title='提示', message='格式錯誤')
#         phone.set("")
#         flag=0
#     if isVaildDate(str(birthday.get())) == False:
# #         showerror(title='提示', message='格式錯誤')
#         birthday.set("")
#         flag=0
#     if flag==0:
#         showerror(title='提示', message='格式錯誤')
    if flag==1:
        fla = 0
        v=[]
        for i in range(len(lst)):
            if sid_1==str(lst[i].get("work_number")):
                fla = 1
                v.append(lst[i].values())
                continue
            elif name_1==lst[i].get("name"):
                fla = 1
                v.append(lst[i].values())
                continue
            elif age_1==lst[i].get("age"):
                fla = 1
                v.append(lst[i].values())
                continue
            elif salary_1==lst[i].get("salary"):
                fla= 1
                v.append(lst[i].values())
                continue
            elif phone_1==lst[i].get("phone"):
                fla = 1
                v.append(lst[i].values())
                continue
            elif birthday_1==lst[i].get("birthday"):
                fla= 1
                v.append(lst[i].values())
                continue
        if fla == 0:
            showerror(title='提示', message='無此信息,搜索失敗!')
        x = dataTreeview.get_children()
        for item in x:
            dataTreeview.delete(item)
        for i in v:
            dataTreeview.insert("", 1, text="line1", values=list(i))
        des()
        
def impInfo():
    root1 = Tk()
    root1.withdraw()
    Folderpath = filedialog.askdirectory() #獲得選擇好的文件夾
    Filepath = filedialog.askopenfilename() #獲得選擇好的文件
    data=pd.read_csv(Filepath)
    
    for i in range(len(data.values)):
        j=list(data.values[i])
        lst=col.find({},{'_id':0})
        flag=0
        for item in lst:
            i=list(item.values())
            if str(j[0])== str(i[0]):
                flag=1
                break
        if flag==0:
            list1 = {
                    "work_number":str(j[0]),
                    "name":j[1],
                    "age":j[2],
                    "salary":j[3],
                    "phone":j[4],
                    "birthday":j[5]
                }
            col.insert_one(list1)
    showinfo(title='提示', message='導(dǎo)入成功,可刷新!')
    
    x = dataTreeview.get_children()
    for item in x:
        dataTreeview.delete(item)
    lst=col.find({},{'_id':0})
    for item in lst:
        i=list(item.values())
        dataTreeview.insert("", 1, text="line1", values=i)
 
def xFunc(event):
    a=xVariable.get() 
    
def exp():
    global info
    info=Toplevel()
    info.title("保存信息")
    info.geometry('500x200')
    button1=Button(info, text="確認(rèn)備份",command=expInfo).place(relx=0.4, rely=0.8, width=100)
    Label(info, text="路徑:",font=("黑體", 10)).place(relx=0.05, rely=0.2, relwidth=0.2)
    button2=Button(info, text="選擇本地",command=selection).place(relx=0.8, rely=0.2, width=70)
    Label(info, text="文件名:",font=("黑體", 10)).place(relx=0.05, rely=0.4, relwidth=0.2)
    com = ttk.Combobox(info, textvariable=xVariable)
    com.place(relx=0.8, rely=0.4, width=70)
    com["value"] = (".csv", ".html", ".xlsx",".xls")    # #給下拉菜單設(shè)定值
    com.current(2)
    com.bind("<<ComboboxSelected>>", xFunc)     # #給下拉菜單綁定事件
    text1=Entry(info, textvariable=path).place(relx=0.25, rely=0.2, relwidth=0.5, height=25)
    text2=Entry(info, textvariable=file_name).place(relx=0.25, rely=0.4, relwidth=0.5, height=25)
    info.bind('<Return>',pas10)
    
 
def selection():
    root2 = Tk()
    root2.withdraw()
    Folderpath = filedialog.askdirectory() #獲得選擇好的文件夾
    path.set(str(Folderpath))
    
def expInfo():
    lst=col.find({},{'_id':0})
    df =  pd.DataFrame(list(lst))
    ftp=xVariable.get()
    file = path.get()+'/'+file_name.get()+xVariable.get() 
    print(file)
    if ftp=='.csv':
        df.to_csv(file,index=False,header=True)
    elif ftp=='.xlsx':
        df.to_excel(file,index=False,header=True)
    elif ftp=='.xls':
        df.to_excel(file,index=False,header=True)
    elif ftp=='.html':
        df.to_html(file,index=False,header=True)
    showinfo(title='提示', message='備份成功!')
    des()
    
 
path = StringVar()
file_name = StringVar()
xVariable = tkinter.StringVar()
#頁面布局            
Button(root, text="刷新信息",command=showAllInfo,font=("黑體", 12),relief="raised", bd=7).place(relx=0.03, rely=0.15, width=120,height=50)
root.bind('<F3>',pas1)
Button(root, text="添加信息",command=add,font=("黑體", 12),relief="raised", bd=7).place(relx=0.03, rely=0.25, width=120,height=50)
root.bind('<F4>',pas2)
Button(root, text="刪除信息",command=pitch_on,font=("黑體", 12),relief="raised", bd=7).place(relx=0.03, rely=0.35, width=120,height=50)
root.bind('<BackSpace>',pas3)
Button(root, text="更新信息",command=information2,font=("黑體", 12),relief="raised", bd=7).place(relx=0.03, rely=0.45, width=120,height=50)
root.bind('<Control-A>',pas4)
Button(root, text="搜索信息",command=search,font=("黑體", 12),relief="raised", bd=7).place(relx=0.03, rely=0.55, width=120,height=50)
root.bind('<Control-S>',pas55)
Button(root, text="導(dǎo)入數(shù)據(jù)",command=impInfo,font=("黑體", 12),relief="raised", bd=7).place(relx=0.03, rely=0.65, width=120,height=50)
root.bind('<Control-D>',pas6)
Button(root, text="導(dǎo)出數(shù)據(jù)",command=exp,font=("黑體", 12),relief="raised", bd=7).place(relx=0.03, rely=0.75, width=120,height=50)
root.bind('<Control-W>',pas7)
 
dataTreeview = ttk.Treeview(root, show='headings',height=20, column=('sid', 'name', 'age','salary','phone','birthday'))
dataTreeview.column('sid', width=10, anchor="center")
dataTreeview.column('name', width=10, anchor="center")
dataTreeview.column('age', width=10, anchor="center")
dataTreeview.column('salary', width=10, anchor="center")
dataTreeview.column('phone', width=10, anchor="center")
dataTreeview.column('birthday', width=10, anchor="center")
style_value = ttk.Style()
style_value.configure("dataTreeview", rowheight=20, font=("微軟雅黑", 30))
dataTreeview.tag_configure('tag_odd',background="red",foreground="blue")
dataTreeview.tag_configure('tag_even',background="black",foreground="orange")
scrollBar=Scrollbar(width=20)
scrollBar.pack(side=RIGHT,fill=Y)
scrollBar.config(command=dataTreeview.yview)
 
 
dataTreeview.heading('sid', text='工號')
dataTreeview.heading('name', text='姓名')
dataTreeview.heading('age', text='年齡')
dataTreeview.heading('salary', text='薪水')
dataTreeview.heading('phone', text='電話')
dataTreeview.heading('birthday', text='生日')
dataTreeview.bind('<Double-Button-1>',information)
dataTreeview.bind('<ButtonRelease-1>',pas9)
x = dataTreeview.get_children()
for item in x:
    dataTreeview.delete(item)
lst=col.find({},{'_id':0})
for item in lst:
    i=list(item.values())
    dataTreeview.insert("", 1, text="line1", values=i)
dataTreeview.place(relx=0.2,rely=0.1, relwidth=0.78,relheight=20)
 
root.mainloop()

效果展示

python基于Tkinter實(shí)現(xiàn)人員管理系統(tǒng)

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。

原文鏈接:https://blog.csdn.net/m0_55762164/article/details/121497501

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 欧美精品日日鲁夜夜添 | 一色桃子av大全在线播放 | 人人看人人艹 | 一级毛片播放 | 女人叉开腿让男人桶 | 亚州综合 | av免费大全| 久久精品超碰 | 国产黄色网 | 精品人伦一区二区三区蜜桃网站 | 97久色| 永久av在线免费观看 | 深夜免费观看视频 | 免费看综艺策驰影院 | 我爱我色成人网 | 在线无码 | 成人在线视频播放 | 免费看成人毛片 | 久久精品一区视频 | 精品一区二区三区中文字幕老牛 | 欧美日韩一区,二区,三区,久久精品 | 国产毛片视频 | 999久久久久久 | 久久精品亚洲国产奇米99 | 精品国产91久久久久久久妲己 | 毛片中文字幕 | 91短视频在线视频 | 久久亚洲激情 | 日韩视频中文 | 久久亚洲精品视频 | 国产高清自拍一区 | 黄在线看 | 毛片免费视频观看 | 日本欧美一区二区 | 日韩伦理电影免费观看 | 国产人妖一区二区 | 蜜桃视频在线入口www | 九九热视频免费 | 欧美日韩一区二区综合 | 日日操视频 | www69xxxxx|