Tkinter Programming code by examples
5
'''1.第一个Listbox''' .................................................................................................................35
'''2.Listbox可以选中多个item'''..............................................................................................35
'''3.使用Listbox支持鼠标移动选中位置''' .............................................................................35
'''4.使Listbox支持Shift和Control。''' .....................................................................................36
'''5.向Listbox中添加一个item'''..............................................................................................36
'''6.删除Listbox中的item'''......................................................................................................37
'''7.选中或取消Listbox中的item''' ..........................................................................................37
'''8.得到当前Listbox中的item个数''' ......................................................................................38
'''9.返回指定索引的item''' ......................................................................................................38
'''10.返回当前选中的item的索引''' ........................................................................................39
'''11.判断一个item是否被选中'''.............................................................................................39
'''12.Listbox与变量绑定''' .......................................................................................................39
'''13.Listbox与事件绑定''' .......................................................................................................40
'''Tkinter教程之Scale篇'''................................................................................................................41
'''1.第一个Scale例子'''.............................................................................................................41
'''2.指定创建Scale的参数'''.....................................................................................................41
'''3.Scale绑定变量'''.................................................................................................................41
'''4.使用事件处理函数打印Scale当前的值'''.........................................................................42
'''5.控制Scale显示位数'''.........................................................................................................42
'''6.设置Scale的标签属性'''.....................................................................................................43
'''7.设置/取得Scale的值'''........................................................................................................43
'''Tkinter教程之Spinbox篇''' ...........................................................................................................45
'''1.第一个Spinbox例子'''........................................................................................................45
'''2.创建Spinbox时指定参数。''' ............................................................................................45
'''3.设置Spinbox的值'''............................................................................................................45
'''4.Spinbox绑定变量 '''..........................................................................................................46
'''5.设置Spinbox的事件处理函数''' ........................................................................................47
'''6.打印Spinbox的当前内容''' ................................................................................................47
'''7.删除Spinbox字符(这是个有问题的程序)''' ................................................................48
'''8.在Spinbox指定位置插入文本''' ........................................................................................49
'''Tkinter教程之Scrollbar篇'''..........................................................................................................51
'''1.第一个Scrollbar例子'''.......................................................................................................51
'''2.设置slider的位置''' ............................................................................................................51
'''3.使用事件处理函数(不建议这样使用)'''......................................................................51
'''4.绑定Listbox与Scrollbar'''...................................................................................................52
'''5.将yscrollcommad与scrollbar的set解除绑定'''...................................................................53
'''6.解除Scrollbar.command与Listbox.yview的关系''' ...........................................................53
'''Tkinter教程之Menu篇''' ...............................................................................................................55
'''1.第一个Menu例子'''............................................................................................................55
'''2.添加下拉菜单''' .................................................................................................................55
'''3.向菜单中添加Checkbutton项'''.........................................................................................56
'''4.向菜单 中添加Radiobutton项'''........................................................................................57
'''5.向菜单中添加分隔符''' .....................................................................................................57
''' 6.快捷菜单''' ........................................................................................................................58