python: GUI using tkinter
python.exe -m pip install --upgrade pip
pip install pymssql
pip install pymysql
pip install mysql-connector-python
pip install pyodbc
pip install DBUtils
pip install xlrd
pip install xlwt
pip install xlutils
pip install xlwings
pip install XlsxWriter
pip install openpyxl
pip install pandas
pip install pandasql
pip install win32com
pip install SQLAlchemy
pip install pyspark
pip install pyinstaller 打包执行exe文件的包
pip install pdfplumber pdf
pip install pillow image
pip install zope.interface
pip install ttkbootstrap
pip install PyQt5
pip install PyQt5-tools
pip install wxPython
pip install sqlacodegen 使用逆向工程工具自动生成Sqlalchemy Mapping类
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 | """ StudentUI.py 读文件类 date 2023-06-24 edit: Geovin Du,geovindu, 涂聚文 ide: PyCharm 2023.1 python 11 """ import datetime import sys import os from tkinter import ttk from tkinter import * from tkinter.ttk import * from ttkbootstrap import Style # pip install ttkbootstrap import random import Model.StudentListInfo import BLL.StudentListBLL class StudentUi( object ): global tree stubll = BLL.StudentListBLL.StudentBll() def __init__( self ): self .name = "geovindu" def __del__( self ): print (f "{self.name}" ) def delete( cls ): #global tree curItem = cls .tree.focus() val = cls .tree.item(curItem)[ 'values' ][ 0 ] #id print (val) print ( cls .tree.selection()) cls .tree.delete( cls .tree.selection()) cls .stubll.delSql(val) #需要删除关联的数据才可以删除 #cls.stubll.delSql() def main( cls ): """ 窗体绑定数据 :return: """ #stubll = BLL.StudentListBLL.StudentBll() geovindu = cls .stubll.selectSqlOrder( "StudentNO asc" ) # list() style = Style(theme = 'darkly' ) #定义窗口样式 window = style.master window.title( "学生管理" ) # win = Tk() screenWidth = window.winfo_screenwidth() screenHeight = window.winfo_screenheight() width = 100 height = 600 x = int ((screenWidth - width) / 2 ) y = int ((screenHeight - height) / 2 ) window.geometry( '{}x{}+{}+{}' . format (width,height,x,y)) #Treeview 控件 cls .tree = ttk.Treeview(master = window,style = 'success.Treeview' ,height = 25 ,show = 'headings' ) cls .tree.pack() #定义列 cls .tree[ 'columns' ] = ( "StudentId" , "StudentName" , "StudentNO" , "StudentBirthday" , "Age" ) #设置列属性,列不显示 cls .tree.column( "StudentId" ,width = 150 ,minwidth = 100 ,anchor = S) cls .tree.column( "StudentName" , width = 150 , minwidth = 100 , anchor = S) cls .tree.column( "StudentNO" , width = 150 , minwidth = 100 , anchor = S) cls .tree.column( "StudentBirthday" , width = 150 , minwidth = 100 , anchor = S) cls .tree.column( "Age" , width = 150 , minwidth = 100 , anchor = S) #设置表头 cls .tree.heading( "StudentId" ,text = "序号" ) cls .tree.heading( "StudentName" , text = "姓名" ) cls .tree.heading( "StudentNO" , text = "学号" ) cls .tree.heading( "StudentBirthday" , text = "出生日期" ) cls .tree.heading( "Age" , text = "年龄" ) #treeView控件绑定数据 i = 1 for Model.StudentListInfo.StudentList in geovindu: cls .tree.insert(" ",i,text=" 2 ",values = (Model.StudentListInfo.StudentList.getStudentId(),Model.StudentListInfo.StudentList.getStudentName(),Model.StudentListInfo.StudentList.getStudentNO(),Model.StudentListInfo.StudentList.getStudentBirthday(),Model.StudentListInfo.StudentList.getAge())) i + = 1 #删除按钮 ttk.Button(window,text = "删除" ,style = 'success,TButton' ,command = cls .delete).pack(side = 'left' ,padx = 5 ,pady = 10 ) window.mainloop() |
https://likegeeks.com/python-gui-examples-tkinter-tutorial/#Get_input_using_Entry_class_Tkinter_textbox
https://docs.python.org/3/library/tk.html
https://zetcode.com/tkinter/menustoolbars/
https://realpython.com/python-menus-toolbars/
https://pythonguides.com/python-tkinter-menu-bar/
https://www.delftstack.com/tutorial/tkinter-tutorial/tkinter-menubar/
https://apidemos.com/tkinter/tkinter-menu/tkinter-menu-create-toolbar.html#ftoc-heading-1
https://docs.python.org/3/library/dialog.html
https://www.pythonguis.com/tutorials/packaging-tkinter-applications-windows-pyinstaller/ 打包介绍
https://pythonguides.com/python-tkinter-multiple-windows-tutorial/ 打开另一个窗体
https://pythonguides.com/python-tkinter-multiple-windows-tutorial/ 注册窗体
学习的路是漫长的.....
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
2018-06-26 The open source JavaScript graphing library that powers Plotly
2017-06-26 csharp: Configuring ASP.NET with Spring.NET and FluentNHibernate
2010-06-26 asp.net3.5 csharp Calendar 控件显示周次
2009-06-26 jQuery InputHintBox