编写选课程序。左侧列表框显示学生可以选择的课程名称,右侧列表框显示学生已经选择的课程名通过四个按钮再两个列表框中移动数据项。
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) theLe