Create Forms using Tkinter

Python GUI window we can create by using Frame in Tkinter. Frame works as a container to put the widgets(like label,button etc) on it.

Tkinter Form and widget design:

GUI form and widget may de designed as following

from tkinter import *
root=tk.Tk()
frame=tk.Frame(root)
frame.pack()
root.mainloop()

Output of the above program is as following.

To set the size of the frame window geometry(width*height)  function may be used as following example. The controls may also be sized  with width and height attribute.

from tkinter import *
def GameScreen():
game_screen=Tk()
game_screen.title("Game Screen")
game_screen.geometry("300x250")
Label(game_screen, text="Please enter your name").pack()
Label(game_screen, text="Username").pack()
username_entry = Entry(game_screen, textvariable="username").pack()
Button(game_screen, text="Click", width=10, height=1).pack()
game_screen.mainloop()
GameScreen()

Output of the above program is as following.

Click Here

Video/ C Introduction

Watch video in full size