1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      怎么在python中利用tkinter實現(xiàn)一個學(xué)生管理系統(tǒng)-創(chuàng)新互聯(lián)

      這篇文章將為大家詳細(xì)講解有關(guān)怎么在python中利用tkinter實現(xiàn)一個學(xué)生管理系統(tǒng),文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

      目前創(chuàng)新互聯(lián)已為上千多家的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)頁空間、網(wǎng)站運(yùn)營、企業(yè)網(wǎng)站設(shè)計、阿克陶網(wǎng)站維護(hù)等服務(wù),公司將堅持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。python可以做什么

      Python是一種編程語言,內(nèi)置了許多有效的工具,Python幾乎無所不能,該語言通俗易懂、容易入門、功能強(qiáng)大,在許多領(lǐng)域中都有廣泛的應(yīng)用,例如最熱門的大數(shù)據(jù)分析,人工智能,Web開發(fā)等。

      具體內(nèi)容如下

      from tkinter import *
      from tkinter.messagebox import *
      import sqlite3
      from tkinter import ttk
       
      dbstr = "H:\mydb.db"
       
      root = Tk()
      root.geometry('700x1000')
      root.title('學(xué)生管理系統(tǒng)')
       
      Label(root, text="學(xué)號:").place(relx=0, rely=0.05, relwidth=0.1)
      Label(root, text="姓名:").place(relx=0.5, rely=0.05, relwidth=0.1)
      Label(root, text="電話:").place(relx=0, rely=0.1, relwidth=0.1)
      Label(root, text="地址:").place(relx=0.5, rely=0.1, relwidth=0.1)
       
      sid = StringVar()
      name = StringVar()
      phone = StringVar()
      address = StringVar()
      Entry(root, textvariable=sid).place(relx=0.1, rely=0.05, relwidth=0.37, height=25)
      Entry(root, textvariable=name).place(relx=0.6, rely=0.05, relwidth=0.37, height=25)
       
      Entry(root, textvariable=phone).place(relx=0.1, rely=0.1, relwidth=0.37, height=25)
      Entry(root, textvariable=address).place(relx=0.6, rely=0.1, relwidth=0.37, height=25)
       
      Label(root, text='學(xué)生信息管理', bg='white', fg='red', font=('宋體', 15)).pack(side=TOP, fill='x')
       
       
      def showAllInfo():
       x = dataTreeview.get_children()
       for item in x:
        dataTreeview.delete(item)
       con = sqlite3.connect(dbstr)
       cur = con.cursor()
       cur.execute("select * from student")
       lst = cur.fetchall()
       for item in lst:
        dataTreeview.insert("", 1, text="line1", values=item)
       cur.close()
       con.close()
       
       
      def appendInfo():
       if sid.get() == "":
        showerror(title='提示', message='輸入不能為空')
       elif name.get() == "":
        showerror(title='提示', message='輸入不能為空')
       elif phone.get() == "":
        showerror(title='提示', message='輸入不能為空')
       elif address.get() == "":
        showerror(title='提示', message='輸入不能為空')
       else:
        x = dataTreeview.get_children()
        for item in x:
         dataTreeview.delete(item)
        list1 = []
        list1.append(sid.get())
        list1.append(name.get())
        list1.append(phone.get())
        list1.append(address.get())
        con = sqlite3.connect(dbstr)
        cur = con.cursor()
        cur.execute("insert into student values(?,?,?,?)", tuple(list1))
        con.commit()
        cur.execute("select * from student")
        lst = cur.fetchall()
        for item in lst:
         dataTreeview.insert("", 1, text="line1", values=item)
        cur.close()
        con.close()
       
       
      def deleteInfo():
       con = sqlite3.connect(dbstr)
       cur = con.cursor()
       cur.execute("select * from student")
       studentList = cur.fetchall()
       cur.close()
       con.close()
       print(studentList)
       
       num = sid.get()
       flag = 0
       if num.isnumeric() == False:
        showerror(title='提示', message='刪除失敗')
       for i in range(len(studentList)):
        for item in studentList[i]:
         if int(num) == item:
          flag = 1
          con = sqlite3.connect(dbstr)
          cur = con.cursor()
          cur.execute("delete from student where id = ?", (int(num),))
          con.commit()
          cur.close()
          con.close()
          break
       if flag == 1:
        showinfo(title='提示', message='刪除成功!')
       else:
        showerror(title='提示', message='刪除失敗')
       
       x = dataTreeview.get_children()
       for item in x:
        dataTreeview.delete(item)
       
       con = sqlite3.connect(dbstr)
       cur = con.cursor()
       cur.execute("select * from student")
       lst = cur.fetchall()
       for item in lst:
        dataTreeview.insert("", 1, text="line1", values=item)
       cur.close()
       con.close()
       
       
      Button(root, text="顯示所有信息", command=showAllInfo).place(relx=0.2, rely=0.2, width=100)
      Button(root, text="追加信息", command=appendInfo).place(relx=0.4, rely=0.2, width=100)
      Button(root, text="刪除信息", command=deleteInfo).place(relx=0.6, rely=0.2, width=100)
       
       
      dataTreeview = ttk.Treeview(root, show='headings', column=('sid', 'name', 'phone', 'address'))
      dataTreeview.column('sid', width=150, anchor="center")
      dataTreeview.column('name', width=150, anchor="center")
      dataTreeview.column('phone', width=150, anchor="center")
      dataTreeview.column('address', width=150, anchor="center")
       
      dataTreeview.heading('sid', text='學(xué)號')
      dataTreeview.heading('name', text='名字')
      dataTreeview.heading('phone', text='電話')
      dataTreeview.heading('address', text='地址')
       
      dataTreeview.place(rely=0.3, relwidth=0.97)

      關(guān)于怎么在python中利用tkinter實現(xiàn)一個學(xué)生管理系統(tǒng)就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。


      新聞標(biāo)題:怎么在python中利用tkinter實現(xiàn)一個學(xué)生管理系統(tǒng)-創(chuàng)新互聯(lián)
      分享URL:http://ef60e0e.cn/article/ddogdh.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        凤冈县| 平南县| 黔东| 林州市| 闽清县| 阿勒泰市| 宁远县| 蓝山县| 纳雍县| 虞城县| 利辛县| 贵溪市| 舞钢市| 乌审旗| 桂东县| 育儿| 贵阳市| 肃宁县| 醴陵市| 乐亭县| 苍溪县| 邯郸市| 神池县| 滦南县| 漯河市| 肇州县| 婺源县| 井陉县| 泰顺县| 崇义县| 花莲县| 龙游县| 南靖县| 萨嘎县| 乌拉特后旗| 揭阳市| 德格县| 缙云县| 怀化市| 安康市| 红河县|