Tkinter Python Tutorial Python GUI Programming Using Tkinter Tutorial Python Training | Desktop App1

This video on Tkinter tutorial covers all the basic aspects of creating and making use of your own simple Graphical User Interface (GUI) using Python. It establishes all of the concepts needed to get started with building your own user interfaces while coding in Python.

#PythonGUI #GUITkinter #GUI #tkinter

Tkinter Tutorial:
=========================

Python Tkinter correct pronunciation:

The Tkinter module “Tk interface”

Which means it can’t be Tea Kinter beacause the T and K are grouped together, it must be Teakay-inter.

Python provides standard library for creating GUI
Creating Desktop based application

Step :
1) import Tkinter module
2) Main window
3) add widgets like button, label, frames, choice box & etc..
4) Call one or other event on the widgets

Lets create Python Hello World to Tkinter libray

import tkinter as tk # Python 3 My current PYthon versin is 3
#import Tkinter as tk # for Python 2
root=tk.Tk()
window=tk.Label(root, text=”Hello World tkinter Module”)
window.pack()
root.mainloop()

Explanation:
=============

1) tkinter module contains Tk toolkit, its always to be imported.
import tkinter as tk

We have imported tkinter by renaming it into tk

2) root=tk.Tk()

to intialize tkinter we have to create Tk root widget,
root is window which contains title bar and other feature provided by window manager
The root has to be created before any other widgets(like label or button etc)
There can be only one root widget

3) window=tk.Label(root, text=”Hello World tkinter Module”)
Label widget
First parameter “root” : label call is name of parent window, in our python application root.
So our label widget is child of “root” widget

text parameter specifies Message or text to be
shown.

4) window.pack()
pack method responsible for Tk module to fit the size of the window to the given Widgets(In my case i have label only).

5) root.mainloop()
window will not appear untill we enter the tkinter event into loop.

In our case, our python script will remain in the event loop untill we CLOSE the window.

Tkinter Widgets:
Button :
Canvas : used to draw the canvas on the window
CheckButton:
Entry: Used to display single line text field/input field.
(To accept input values from the user)
Label: Display some text or message or information
ListBox: Used to display a list of options
Frame : Container, another widgets can be added to the Frame and can be organized
Menu: add menu items
MenuButton: Display the menu items
RadioButton:
Scrollbar :For scroll the window
Message: to display the message box
Text: Used to display Multi line text field/input field.
Scale: Work with Slider
LabelFrame: Container widget
Spinbox: To select from options of values
PanedWindow: Container, for horizontal or vartical panes
Toplevel : To create separeat window container
MessageBox: to display message box
Dialog: to show warning

and etc….

Post Author: hatefull