Tkinter Examples
Tkinter Examples
These examples demonstrate the use of Pythons tkinter module. It is intentional that neither the Tk
themed widget set (ttk) module nor an Object Oriented approach is used. They are intended as
teaching examples for exploration and extension.
Contents
Example 1: Hello GUI! .................................................................................................................................... 2
Example 2: Button with a callback function .................................................................................................. 3
Example 3: A button and label ...................................................................................................................... 4
Example 4: Reading user input ...................................................................................................................... 5
Example 5: Simple guessing game ................................................................................................................. 6
Example 6: Guessing game with reset button and global variables.............................................................. 7
Example 7: Password checking using * masking ........................................................................................ 9
Example 8: Pig Latin one word only.......................................................................................................... 11
Example 9: Pig Latin phrases .................................................................................................................... 12
Example 10: Dynamic GUI generation with lambda functions.................................................................... 13
Page 1 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 2 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 3 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 4 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 5 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 6 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 7 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 8 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 9 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 10 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 11 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 12 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/
Simple GUI Program Examples with Python 3
Page 13 of 13
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
http://creativecommons.org/licenses/by-nc-sa/4.0/