introduction to python tkinter

Опубликовано: 16 Июнь 2026
на канале: Code Masters
55
2

Watch the video explanation in the description!! Create Your First GUI
Tkinter Python GUI Tutorial For Beginners.
his video shows How to Create Simple drawing Application Using Python Tkinter.
We will create this drawing app with a python turtler with color. This video shows python turtle ghrpichs and pythn tkinter GUI

Learn How to Create a Button using tkinter.Button method and how to define the button background color
and add functions to a button , we add a turtle function which draws a half circle

------------------------- (Learn)--------------------------------

modules, functions, methods, and variables:


1- import turtle: this turtle module used to draw shapes like SVG at HTML5, it helps to learn functions and methods by see the turtle draw something according to your orders.
2- import tkinter:
tkinter provides classes that allow the display, positioning, and control of widgets. Toplevel widgets are Tk and Toplevel. Other
widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
Check button, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
LabelFrame and PanedWindow. { copied from Python help() }

3- x = turtle.Turtle: using the value of the turtle method which able to draw shapes to variable x, same as var ctx = canvas.getContext("2d"); at Javascript to start drawing.

(root)
4- root = tk.Tk() assign the value of Tk() method to the var root

(frame)
5-frame = tk.The frame (root) create the frame we will draw on it which is inherited from the root
6- frame.pack() : use this always after any adding to run the method

(button)
7-tk.Button( text="button text", fg="green" bg="white" command = quit)
text = the text on the button, fg = font color , bg = back ground color
command = quit, command: is for running the function or method, we have already created our function bot() at the video before we run the tk.button() method to avoid getting not defined error

8-button.pack(side=tk.LEFT) : to confirm and add the button to the frame and side = tk.LEFT control your element or added item position like text align in html or margin

(call the function and start it)
root.mainloop()


https://www.w3schools.com
https://classroom.udacity.com/me
https://www.python.org - help() method


Please Subscribe to see more programming videos