使用Python做一个简易的选课小程序!大学必备技能!
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了使用Python做一个简易的选课小程序!大学必备技能!,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1791字,纯文字阅读大概需要3分钟。
内容图文
![使用Python做一个简易的选课小程序!大学必备技能!](/upload/InfoBanner/zyjiaocheng/620/67d99039310241dca034b0e5e8cf8d42.jpg)
编写选课程序。左侧列表框显示学生可以选择的课程名称,右侧列表框显示学生已经选择的课程名通过四个按钮再两个列表框中移动数据项。
from tkinter import * from tkinter import ttk billwindows=Tk() billwindows.title("Bill选课系统") def callbutton1(): for i in theLeftBox.curselection(): theRightBox.insert(0, theLeftBox.get(i)) theLeftBox.delete(i) def callbutton2(): for i in theRightBox.curselection(): theLeftBox.insert(0, theRightBox.get(i)) theRightBox.delete(i) def callbutton3(): for i in range(0, theLeftBox.size()): theRightBox.insert(0, theLeftBox.get(i)) for i in range(theLeftBox.size() - 1, -1, -1): theLeftBox.delete(i) def callbutton4(): for i in range(0, theRightBox.size()): theLeftBox.insert(0, theRightBox.get(i)) for i in range(theRightBox.size() - 1, -1, -1): theRightBox.delete(i) KCB=["Python程序设计","面向对象程序设计","计算机网络","单片机","如何一夜暴富","如何找到一个女朋友"] #billwindows.geometry('1200x800') theRightBox = Listbox(billwindows) theLeftBox = Listbox(billwindows) for item in KCB: theLeftBox.insert(END, item) theLeftBox.grid(row=0, column=0, rowspan=4) tb1 = Button(billwindows, text='>', bg="pink",command=callbutton1, width=20) tb2 = Button(billwindows, text='<', bg="pink",command=callbutton2, width=20) tb3 = Button(billwindows, text='>>', bg="pink",command=callbutton3, width=20) tb4 = Button(billwindows, text='<<', bg="pink",command=callbutton4, width=20) w=Label(billwindows,text="您好,欢迎使用BillChen选课系统",relief="groove",borderwidth=8) tb1.grid(row=0, column=1) tb2.grid(row=1, column=1) tb3.grid(row=2, column=1) tb4.grid(row=3, column=1) w.grid(row=4,column=1) theRightBox.grid(row=0, column=2, rowspan=4) billwindows.mainloop()
运行效果
PS:如有需要Python学习资料的小伙伴可以加点击下方链接自行获取
内容总结
以上是互联网集市为您收集整理的使用Python做一个简易的选课小程序!大学必备技能!全部内容,希望文章能够帮你解决使用Python做一个简易的选课小程序!大学必备技能!所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。