当前位置:首页 > 书籍 > python
目录
(一):接触 Tkinter..................................................................................... 7
(二):
Tkinter 的两大常用组件 Label Button.................................... 10
(三):
Tkinter 的三个组件 CheckbuttonRadiobutton Labelframe.. 14
Checkbutton .............................................................................................................14
Radiobutton..............................................................................................................16
Labelframe................................................................................................................18
(四):
Tkinter 组件 Entry......................................................................... 19
Entry 组件:输入框 ...............................................................................................19
(五):
Tkinter 组件 ListboxScrollbar Scale ..................................... 29
Listbox.......................................................................................................................29
Scrollbar 滚动条组件 ............................................................................................30
Scale 组件 ...............................................................................................................32
(六):
Tkinter Text 组件 .................................................................... 34
目录:......................................................................................................................34
简单用法 .................................................................................................................35
插入图片和组件 .....................................................................................................35
插入按钮 .................................................................................................................35
插入图片 .................................................................................................................37
Indexs 索引 ..............................................................................................................38
line.column ...............................................................................................................38
line.end .....................................................................................................................39
INSERT.......................................................................................................................40
CURRENT...................................................................................................................40
END("end")...........................................................................................................40
user-defined marks ..................................................................................................403
User-defined tags("tag.first", "tag.last")..................................................................40
selection(SEL_FIRST, SEL_LAST) ...............................................................................41
window coordinate("@x,y") ....................................................................................41
embedded object name(window, images)..............................................................41
expressions...............................................................................................................41
Marks 用法 ..............................................................................................................43
Tags 用法 .................................................................................................................46
设置样式 .................................................................................................................47
设置 Tag 优先级 .....................................................................................................50
事件绑定 .................................................................................................................51
(七):
Tkinter Text 组件实用技巧 ..................................................... 53
判断内容是否发生变化 ...................................................................................53
查找操作 ............................................................................................................54
③Text 组件还支持恢复和撤销的操作 ..............................................................55
自定义撤销操作 .....................................................................................................57
(八):
Tkinter Canvas 组件 1............................................................. 58
绘制对象 .................................................................................................................58
修改对象 .................................................................................................................59
显示文本 .................................................................................................................60
画圆或椭圆 .............................................................................................................61
画多边形 .................................................................................................................62
(九):
Tkinter Canvas 组件 2............................................................. 64
Canvas 组件支持对象 ............................................................................................65
坐标系 .....................................................................................................................65
画布对象显示的顺序 .............................................................................................65
指定画布对象 .........................................................................................................66
(十):
Tkinter 的组件 MenuMenubutton OptionMenu................. 67
创建一个顶级菜单 .................................................................................................67
实现下拉菜单和级联菜单: .................................................................................684
实现弹出菜单 .........................................................................................................69
一个带有 Checkbutton Radiobutton 的菜单 ...............................................70
Menubutton 组件 ..................................................................................................72
选择菜单 .................................................................................................................73
星号* 作用 .............................................................................................................74
一、星号(
*)作为形参,表示调用可变参数函数: ......................................75
二、星号(
*)作为实参时,表示通过解包参数调用函数 .............................75
(十一):Tkinter 事件绑定 ....................................................................... 77
目录 .........................................................................................................................77
实例 .........................................................................................................................78
捕获鼠标点击的位置的演示 ................................................................................78
关于键盘的演示 .....................................................................................................79
利用<Motion>事件获取鼠标实时位置的方式 ....................................................80
事件序列 .................................................................................................................81
type ...........................................................................................................................81
modifier ....................................................................................................................83
Event 对象 ...............................................................................................................83
Key names.................................................................................................................83
(十二):Tkinter 的组件 Message............................................................ 87
目录 .........................................................................................................................87
实例 .........................................................................................................................87
何时使用 Message 组件?...................................................................................88
用法 .........................................................................................................................88
参数 .........................................................................................................................88
(十三):Tkinter 的组件 Spinbox ............................................................. 90
用法 .........................................................................................................................90
参数 .........................................................................................................................91
(十四):Tkinter 的组件 PanedWindow................................................... 95
目录 .........................................................................................................................95
何时使用 PanedWindow 组件? .........................................................................95
用法 .........................................................................................................................95
参数 .........................................................................................................................98
方法 .........................................................................................................................99
forget(child)..............................................................................................................99
identify(x, y)..............................................................................................................99
panecget(child, option)..........................................................................................100
panecget(child, option)..........................................................................................100
paneconfig(child, **option)...................................................................................100
(十五):Tkinter 的组件 Toplevel Tk Toplevel 的方法 ............. 101
目录 .......................................................................................................................101
何时使用 Toplevel 组件?....................................................................................101
Tk(根窗口)和 Toplevel(顶级窗口)的方法 ................................................102
attribute(*args)args 参数 ................................................................................106
(十六):Tkinter 的三大布局管理器 packgrid place.................... 107
目录 .......................................................................................................................107
何时使用 pack 管理器?......................................................................................108
何时使用 grid 管理器? .......................................................................................110
如何使用 place 管理器:.....................................................................................112
pack 的方法 ...........................................................................................................115
pack(**options)......................................................................................................115
pack_configure(**options)....................................................................................115
pack_forget() ..........................................................................................................115
pack_info()..............................................................................................................116
pack_propagate(flag) .............................................................................................116
pack_slaves() ..........................................................................................................116
grid 的方法:........................................................................................................116
grid(**options).......................................................................................................116
grid_bbox(column=None, row=None, col2=None, row2=None) .........................117
grid_columnconfigure(index, **options)..............................................................117
grid_configure(**options) .....................................................................................117
56
grid_forget()............................................................................................................117
grid_info()...............................................................................................................117
grid_location(x, y)...................................................................................................118
grid_propagate(flag)...............................................................................................118
grid_remove().........................................................................................................118
grid_rowconfigure(index, **options)....................................................................118
grid_size() ...............................................................................................................118
grid_slaves(row=None, column=None).................................................................118
place 的方法 .........................................................................................................118
place(**options).....................................................................................................119
place_configure(**options)...................................................................................119
place_forget() .........................................................................................................120
place_info().............................................................................................................120
place_slaves() .........................................................................................................120
slaves()....................................................................................................................120
( 十 七 ): Tkinter 的标准对话框模块 messagebox filedialog
colorchooser.............................................................................................. 121
目录 .......................................................................................................................121
Messagebox(消息对话框) ...............................................................................121
函数参数 ...............................................................................................................123
函数返回值 ...........................................................................................................124
filedialog(文件对话框).....................................................................................124
函数参数 ...............................................................................................................125
filetypes 图解:.....................................................................................................126
函数返回值 ...........................................................................................................126
colorchooser(颜色对话框) ..............................................................................126
函数参数 ...............................................................................................................127
函数返回值 ...........................................................................................................128
Q&A.........................................................................................................................128