Skip to main content

Posts

My First Window dissected

Let's look at the three lines of My First Window code. The first line is: from tkinter import * This imports the tkinter module. You have to import it if you want to use the widgets the module provides. How else would you use them if you did not tell your Python that you will be using it? So, you import it. This syntax which we used in our My First Window is the worst possible way to do it. from tkinter import * That works. It is short and sweet. Yet, it is horrible. I could explain why but once again I do not feel like reinventing. Read this and this to find out why it is such a bad idea to use that syntax. Building a blog is not only a great way to teach people but it really helps you learn what you are doing because every-time you are about to teach something you have all these possible questions readers might ask pop up into your head. Then, you search for the answers to learn to teach. You also make yourself a great future resource of what you learned in
Recent posts

Python and Tkinter - My First Window

The purpose of the blog is for me to share what I learn. Currently I am working on learning Python and Tkinter. Tkinter allows you to build GUI programs in Python. What are GUI programs? GUI stands for Graphical User Interface . The Windows applications you see on your Windows OS (operating system) are GUIs. Your First Window Program in Python and Tkinter Right click your mouse and choose the option which says Create Text Document. Then label it MyFirstWindow.py. Delete the .txt and replace it with .py. The .py tells the computer that this is a Python file. If you do not see the .txt that means your computer hides file extensions. Read this  or this on how to unhide file extensions. I could write it out here, but why reinvent the wheel? Now, right click on the MyFirstWindow.py file. Move the mouse cursor to Open With . Choose notepad to open the file with. However, do not set it as the default option. Type in the following: from tkinter import *