Python and Tkinter Programming by John E Grayson Ph.D. (z-lib.org).pdf


hxy

Table of Contents

1. What is Tkinter? ...................................................................................................................... 2
2. A minimal application .............................................................................................................. 3
3. Layout management ................................................................................................................ 3
3.1. The .grid() method .................................................................................................... 4
3.2. Other grid management methods ................................................................................... 5
3.3. Configuring column and row sizes ................................................................................. 5
3.4. Making the root window resizeable ................................................................................ 6
4. Standard attributes .................................................................................................................. 7
4.1. Dimensions ................................................................................................................... 7
4.2. Coordinate system ......................................................................................................... 7
4.3. Colors ........................................................................................................................... 7
4.4. Type fonts ..................................................................................................................... 8
4.5. Anchors ........................................................................................................................ 9
4.6. Relief styles ................................................................................................................. 10
4.7. Bitmaps ....................................................................................................................... 10
4.8. Cursors ....................................................................................................................... 10
4.9. Images ........................................................................................................................ 12
4.10. Geometry strings ....................................................................................................... 12
4.11. Window names .......................................................................................................... 12
5. The Button widget ................................................................................................................ 13
6. The Canvas widget ................................................................................................................ 14
6.1. Canvas concepts .......................................................................................................... 16
6.2. Methods on Canvas objects ......................................................................................... 16
6.3. The canvas arc object ................................................................................................... 20
6.4. The canvas bitmap object ............................................................................................. 21
6.5. The canvas image object ............................................................................................... 22
6.6. The canvas line object .................................................................................................. 22
6.7. The canvas oval object .................................................................................................. 23
6.8. The canvas polygon object ............................................................................................ 23
6.9. The canvas rectangle object .......................................................................................... 24
6.10. The canvas text object ................................................................................................. 25
6.11. The canvas window object .......................................................................................... 25
7. The Checkbutton widget ...................................................................................................... 26
8. The Entry widget .................................................................................................................. 29
8.1. Scrolling an Entry widget ........................................................................................... 32
9. The Frame widget .................................................................................................................. 32
10. The Label widget ................................................................................................................ 33
11. The Listbox widget ............................................................................................................ 34
11.1. Scrolling a Listbox widget ....................................................................................... 37
12. The Menu widget .................................................................................................................. 38
12.1. Menu item creation (coption) options ....................................................................... 40
13. The Menubutton widget ...................................................................................................... 41
14. The Radiobutton widget .................................................................................................... 43
15. The Scale widget ................................................................................................................ 46
16. The Scrollbar widget ........................................................................................................ 48
16.1. The scrollbar command callback .................................................................................. 50
16.2. Connecting scrollbars to other widgets ........................................................................ 50
17. The Text widget .................................................................................................................. 51
17.1. Indices in text widgets ................................................................................................ 53
17.2. Marks in text widgets ................................................................................................. 54
17.3. Images in text widgets ................................................................................................ 54
17.4. Windows in text widgets ............................................................................................ 55
17.5. Tags in text widgets ................................................................................................... 55
17.6. Setting tabs in a Text widget ...................................................................................... 55
17.7. Methods on Text widgets .......................................................................................... 56
18. Toplevel: Top-level window methods ................................................................................. 61
19. Universal widget methods .................................................................................................... 62
20. Standardizing appearance ..................................................................................................... 69
20.1. How to name a widget class ....................................................................................... 70
20.2. How to name a widget instance .................................................................................. 71
20.3. Resource specification lines ........................................................................................ 71
20.4. Rules for resource matching ........................................................................................ 72
21. Connecting your application logic to the widgets .................................................................... 72
22. Control variables: the values behind the widgets .................................................................... 73
23. Focus: routing keyboard input ............................................................................................... 75
24. Events .................................................................................................................................. 76
24.1. Levels of binding ....................................................................................................... 76
24.2. Event sequences ......................................................................................................... 77
24.3. Event types ................................................................................................................ 78
24.4. Event modifiers ......................................................................................................... 78
24.5. Key names ................................................................................................................. 79
24.6. Writing your handler ................................................................................................. 81
24.7. The extra arguments trick ........................................................................................... 82
24.8. Virtual events ............................................................................................................ 83
 
Views 262   Last Modified: 2020-06-16 17:52