Skip to content
Sign upLog in
A very short intro to GUIs in Python with Tkinter
Profile icon

Okay, so I need to make a tutorial.

Let's discuss Tkinter.

What is Tkinter?

Tkinter is a module in python for creating GUIs.

It is built in to python so you don't have to use pip3.


Just use repl for now and make a Python Tkinter repl.

At the top type:

from tkinter import *


So Tkinter is a widget-based GUI engine.

Meaning everything is a widget.

So you can have text, button, label, ect. widgets.

And this all exists inside you root widget.

Or your window widget.

Creating a window.

To create a window type this code:

from tkinter import * root = Tk()

So we define a variable as a Tk object called root.

This Tk object is the Tkinter object for root widgets.

If you run you will notice a window!

Adding text.

To add text type this code:

from tkinter import * root = Tk() myLabel = Label(root, text="This is a text label!") myLabel.pack()

So, we import tkinter.

Then we define our root.

Then we define a variable equal to a Label object.

The arguments that we input are the root widget (this tells tkinter where it can go) and then we set the text equal to a string.

Then we use the pack method to just pack the text in there.

What does this mean?

Well instead of us defining where the label goes, the pack() method just puts it in whatever place is free.

Now if you run you will see some text.


Er. This was short but upvote because I need to work on the web dev course. This was just to show you some of what Tkinter could do.

Upvoting is caring :) -


You are viewing a single comment. View All
Profile icon

A GUI is more intuitive. You don't need everything to be at a low level. And your example of Noone is going to learn {x} beacuse they have to learn {y} is completely obselete. I never said they wouldn't want to learn x because they have to learn y. What I did say is that it doesn't need to be this complex. To delete a directory and it's everything in it in a file explorer I just click a few times. The terminal should be available, yes, but priority? No.