0% found this document useful (0 votes)
22 views8 pages

From Tkinter Import TK : Input

The document provides examples of using tkinter in Python to create graphical user interfaces (GUIs). It demonstrates how to create windows, add labels, entries, and buttons, configure fonts and placements, use grids and axes, get input from entries and display it, and other basic tkinter functions.

Uploaded by

RAFSAN T809
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views8 pages

From Tkinter Import TK : Input

The document provides examples of using tkinter in Python to create graphical user interfaces (GUIs). It demonstrates how to create windows, add labels, entries, and buttons, configure fonts and placements, use grids and axes, get input from entries and display it, and other basic tkinter functions.

Uploaded by

RAFSAN T809
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

GUI(Graphical User Interface)- tkinter

Input:

from tkinter import *

Tk()

Output:

 Create window

Input

from tkinter import *

window=Tk()

Output:

 Create window and give size

Input:

from tkinter import *

window=Tk()

window.geometry('700x500')

output:

 Give title

Input:

from tkinter import *


window=Tk()

window.geometry('700x500')

window.title('Thangabali')

Output:

 Use of axis ,write text or anything

Input:

from tkinter import *

window=Tk()

window.geometry('700x500')

window.title('Thangabali')

t1=Label(text='Type anything')

t1.place(x=100,y=100)

output:

 Give font

Input:

from tkinter import *

window=Tk()

window.geometry('700x500')
window.title('Thangabali')

t1=Label(text='Type anything',font=('Arial',30))

t1.place(x=100,y=100)

Output:

GIVE MULTIPLE LINE OR TEXT

Input:

from tkinter import *

window=Tk()

window.geometry('700x500')

window.title('Thangabali')

t1=Label(text='MIS403',font=('Arial',30))

t1.place(x=100,y=100)

t1=Label(text='MIS402',font=('Arial',30))

t1.place(x=200,y=200)

t1=Label(text='MIS404',font=('Arial',30))

t1.place(x=300,y=300)

Output:
Give row and column

Input:

from tkinter import *

window=Tk()

window.geometry('700x500')

window.title('Thangabali')

t1=Label(text='A',font=('Arial',30))

t1.grid(row=1)

Label(text='B',font=('Arial',30)).grid(row=2)

Label(text='C',font=('Arial',30)).grid(row=3)

Label(text='D',font=('Arial',30)).grid(row=4)

Label(text='E',font=('Arial',30)).grid(row=5)
Label(text='F',font=('Arial',30)).grid(column=1)

Label(text='G',font=('Arial',30)).grid(column=2)

Label(text='H',font=('Arial',30)).grid(column=3)

Label(text='I',font=('Arial',30)).grid(column=4)

Output:

Parallel

Input:

from tkinter import *

window=Tk()

window.geometry('700x500')

window.title('Thangabali')

t1=Label(text='A',font=('Arial',30))

t1.grid(row=1)

Label(text='F',font=('Arial',30)).grid(row=7,column=1)

Label(text='G',font=('Arial',30)).grid(row=7,column=2)

Label(text='H',font=('Arial',30)).grid(row=7,column=3)

Label(text='I',font=('Arial',30)).grid(row=7,column=4)

Output:

Give lable, entry and button

Input:

from tkinter import *

window=Tk()

window.geometry('700x500')

window.title('Thangabali')
Label(text='Type your name',font=('Arial',30)).grid(row=1,column=1)

Entry(font=('Arial',30)).grid(row=1,column=2)

Button(text='Submit',font=('arial Narrow',20)).grid(row=2,column=1)

Output:

Use place instead of grid (Axis x & y)

Input:

from tkinter import *

window=Tk()

window.geometry('700x500')

window.title('Thangabali')

Label(text='Type your name: ',font=('Arial',30)).place(x=10,y=200)

Entry(font=('Arial',30)).place(x=300,y=200)

Button(text='Submit',font=('Arial Narrow',20)).place(x=450,y=275)

Output:
Give input and show

Input:

from tkinter import *

def show():

a=inp.get()

b.set(a)

window=Tk()

b=StringVar()

window.geometry('700x500')

window.title('Thangabali')

Label(text='Name',font=('Arial',30)).grid(row=1,column=1)

Label(text=' ',font=('Arial',30),textvariable=b).place(x=500,y=200)
inp=Entry(font=('Arial',30))

inp.grid(row=1,column=2)

Button(text='Submit',font=('Arial Narrow',20),command=show).grid(row=2)

Output:

You might also like