博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
选课小程序
阅读量:3959 次
发布时间:2019-05-24

本文共 1926 字,大约阅读时间需要 6 分钟。

前言继上次写的背单词小程序之后,最近又学了Tkinter库的应用,编写了一个简易的选课小程序 哈~哈

import tkinter as tkcourse=['Pyhon','Java','Linux','计算机网络','编译原理','单片机','形势与政策','ACM']window=tk.Tk()window.title("zw选课程序")window.geometry('600x600')l=tk.Label(window,text="欢迎来到选课程序",bg='green',width=30,height=3)l.grid(row=0,column=1)window.geometry('600x600')theRB=tk.Listbox(window)theLB=tk.Listbox(window)for item in course:    theLB.insert(0,item)    theLB.grid(row=1,column=0,rowspan=4)##############################################def callbutton1():    for i in theLB.curselection():        theRB.insert(0,theLB.get(i))        theLB.delete(i)        def callbutton2():    for i in theRB.curselection():        theLB.insert(0,theRB.get(i))        theRB.delete(i)def callbutton3():    for i in range(0,theLB.size()):        theRB.insert(0,theLB.get(i))    for i in range(theLB.size()-1,-1,-1):        theLB.delete(i)def callbutton4():    for i in range(0,theRB.size()):        theLB.insert(0,theRB.get(i))    for i in range(theRB.size()-1,-1,-1):        theRB.delete(i)###############################################################--------------选课按钮-----------------------------##############################################################tb1=tk.Button(window,text='>',command=callbutton1,width=20)tb3=tk.Button(window,text='>>',command=callbutton3,width=20)tb2=tk.Button(window,text='<',command=callbutton2,width=20)tb4=tk.Button(window,text='<<',command=callbutton4,width=20)################################################################操作说明:>:一次选择点击的课程#		 >>:选择列表框的全部课程#		  <:后悔选择的课程#		 <<:后悔选择全部课程##########################################################tb1.grid(row=1,column=1)tb2.grid(row=3,column=1)tb3.grid(row=2,column=1)tb4.grid(row=4,column=1)##############################################################theRB.grid(row=1,column=2,rowspan=4)l1=tk.Label(window,text="18jk2班->AiY",bg='yellow',width=30,height=1)l1.grid(row=5,column=1)window.mainloop()

运行结果:

在这里插入图片描述

转载地址:http://ugxzi.baihongyu.com/

你可能感兴趣的文章
java des加密
查看>>
struts&hibernate&spring例子
查看>>
inno使用教程
查看>>
网吧系统母盘制作(系统分区整体考虑优化配置篇)
查看>>
spring beans beanfactory applicationcontext
查看>>
使用ORM工具进行数据访问
查看>>
使用ORM工具进行数据访问
查看>>
Quartz 使用手记 --转
查看>>
编译与部署Eclipse+Tomcat+MySQL+Liferay4.1.2
查看>>
MySQL用户授权
查看>>
mysql忘记密码怎么办?~
查看>>
MySQL修改密码方法总结
查看>>
怎么将我的硬盘屏蔽
查看>>
关于MySQL select into 和 SQLServer select into
查看>>
2003应用
查看>>
文件上传组件比较
查看>>
关于MySQL select into 和 SQLServer select into
查看>>
搭建开发环境(初学liferay必看)
查看>>
Apache FileUpload文件上传组件API解析
查看>>
屏蔽usb的方法- -
查看>>