Your first Python GUI program

As we discussed in an earlier chapter, the first program while learning any programming language includes printing Hello World!. Now, as we are starting Python programming for GUI, let's start by printing the same string in a GUI window instead of a prompt.

Just to start with GUI programming, we are going to execute a Python program and then jump into explaining the structure and the details of the code. Let's create a Python executable file using the following lines of code, name it helloGUI.py, and then run it. The execution process should complete without any dependency errors:

import Tkinter # Initialize main windows with title and size top = Tkinter.Tk() top.title("Hello GUI") top.minsize(200,30) # Label widget ...

Get Python Programming for Arduino now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.