Please find the Basic Code to write tkinter Programme
'''By using lable method we can create text , by using entry method we can create box
pack(),grid() and place() are geometry managers'''
# Importing the tkinter
from tkinter import *
import sqlite3
import tkinter as tk
# Initializing the screen
win = tk.Tk()
win.geometry("400x400+10+20")
#Creating the lable
l=Label(win, text='Hellow Nagendra')
# Adding lable to the window
l.pack()
#Creating the entry
e=Entry(win)
e.pack()
#creating the button
b=Button(win, text='Button1')
# Adding Button to the window
b.pack()
# Creating the Text Widget
t=Text(win,width=30,height=10)
# Adding text to the window
t.pack()
# Creating Check Box
c = Checkbutton(win,text='Yes')
# Adding Checkbox to the window
c.pack()
# Creating Radio button
r = Radiobutton(win,text='Yes')
# Adding radio button to the window
r.pack()
# Adding the Option Menu
v=StringVar()
o=OptionMenu(win,v,'Python',*('RAM','kan','Jyo','Tul'))
o.pack()
# Adding the Scale
s=Scale(win,from_=0,to=100)
s.pack()
###you can add widgets here. This is used to start the application
win.mainloop()
No comments:
Post a Comment