To make a graphical user interface, you can use the tkinter module. Tkinter is a module for GUIs (based on the Tk GUI toolkit).
This is the standard graphical user interface for Python. Tkinter is included with Linux, Microsoft Windows and Mac OS X.
With tkinter you can quickly build graphical interfaces. The example below shows you the hello world app.
from tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() root.mainloop()
It loads the module like this:
from tkinter import *
If you get an import error, make sure you are using Python version 3 or newer.
Then tk (root window) is initialized with:
root = Tk()
A label with the text "Hello world" is created and added to the root window
w = Label(root, text="Hello, world!") w.pack()
Level up every day