Search Here

Python program to draw Upper Case Alphabets (A to Z)

   Python code for drawing 'A'
# Draw A
from tkinter import *  

app=Tk()  
app.title("A")  
 
canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=480,height=360)  

canvas.create_line(150,80,80,250,width=5)
canvas.create_line(150,80,230,250,width=5) 
canvas.create_line(110,180,198,180,width=5) 

app.mainloop()

   Python code for drawing 'B'
# Draw B
from tkinter import *  
app=Tk()  
app.title("B")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)  

x=10
canvas.create_arc(x,x+100,x+200,x+200,start=90,extent=-180,outline="black",width=5, style="arc") 
canvas.create_arc(x,x+200,x+200,x+300,start=90,extent=-180,outline="black",width=5, style="arc") 
canvas.create_line(x+100,x+100,x+100,x+300,fill='black',width=5)  

app.mainloop()


   Python code for drawing 'C'
# Draw C
from tkinter import *  

app=Tk()  
app.title("C")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=500) 

c= 20,140,190,370
arc = canvas.create_arc(c,start=90,extent=200,fill="",style="arc",width=5)

app.mainloop()


   Python code for drawing 'D'
# Draw D
from tkinter import *  

app=Tk()  
app.title("D")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=300,height=300) 

c= 210,50,40,210
arc = canvas.create_arc(c,start=90,extent=-180,fill="",width=5)

app.mainloop()


   Python code for drawing 'E'
# Draw E
from tkinter import *  

app=Tk()  
app.title("E")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=500) 

canvas.create_line(200,70,200,380,width=5)
canvas.create_line(200,70,380,70,width=5)
canvas.create_line(200,220,350,220,width=5)
canvas.create_line(200,380,380,380,width=5)

app.mainloop()


   Python code for drawing 'F'
# Draw F
from tkinter import *  

app=Tk()  
app.title("F")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400) 

canvas.create_line(200,70,200,380,width=5)
canvas.create_line(200,70,380,70,width=5)
canvas.create_line(200,220,350,220,width=5)

app.mainloop()


   Python code for drawing 'G'
# Draw G
from tkinter import *  
app=Tk()  
app.title("G")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=480,height=480)  

x=50
canvas.create_arc(x+280,x,x+160,x+280,start=30,extent=240,outline="black",width=5, style="arc")
canvas.create_line(x+220,x+180,x+220,x+280,fill='black',width=5)  
canvas.create_line(x+220,x+180,x+280,x+180,fill='black',width=5)
canvas.create_line(x+280,x+180,x+280,x+280,fill='black',width=5)

app.mainloop()


   Python code for drawing 'H'
# Draw H    
from tkinter import *  

app=Tk()  
app.title("H")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=500)

canvas.create_line(200,70,200,380,width=5)
canvas.create_line(380,70,380,380,width=5)
canvas.create_line(200,220,380,220,width=5)

app.mainloop()


   Python code for drawing 'I'
# Draw I
from tkinter import *  

app=Tk()   
app.title("I")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400) 

canvas.create_line(140,107,140,280,width=5)
canvas.create_line(135,107,145,107,width=5)
canvas.create_line(135,280,145,280,width=5)

app.mainloop()


   Python code for drawing 'J'
# Draw J
from tkinter import *  

app=Tk()    
app.title("J")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)

canvas.create_line(200,70,200,300,width=5)
canvas.create_line(180,70,215,70,width=5)  
c= 200,350,50,240
arc=canvas.create_arc(c,start=0,extent=-180,fill="",style="arc",width=5)                            

app.mainloop()


   Python code for drawing 'K'
# Draw K
from tkinter import *  

app=Tk()  
app.title("K")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400) 
 
canvas.create_line(100,70,100,380,width=5)
canvas.create_line(100,220,280,70,width=5)
canvas.create_line(100,220,280,380,width=5)

app.mainloop()


   Python code for drawing 'L'
# Draw L
from tkinter import *  

app=Tk()  
app.title("L")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=480,height=400)  

canvas.create_line(100,70,100,360,width=5)
canvas.create_line(100,360,280,360,width=5)

app.mainloop()


   Python code for drawing 'M'
# Draw M
from tkinter import *  

app=Tk()  
app.title("M")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=500,height=400)  

canvas.create_line(200,70,200,380,width=5)
canvas.create_line(200,70,300,220,width=5)
canvas.create_line(300,220,400,70,width=5)
canvas.create_line(400,70,400,380,width=5)

app.mainloop()


   Python code for drawing 'N'
# Draw N
from tkinter import *  

app=Tk()  
app.title("N")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)  

canvas.create_line(100,70,100,380,width=5)
canvas.create_line(280,70,280,380,width=5)
canvas.create_line(100,70,280,380,width=5)

app.mainloop()


   Python code for drawing 'O'
# Draw O
from tkinter import *  

app=Tk()  
app.title("O")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400) 
 
canvas.create_oval(120,120,280,300,width=5)

app.mainloop()


   Python code for drawing 'P'
# Draw P
from tkinter import *  

app=Tk()  
app.title("P")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)
  
c= 310, 20, 70, 180
arc = canvas.create_arc(c,start=90,extent=-180,fill="",width=5)
canvas.create_line(190,70,190,380,width=5)

app.mainloop()


   Python code for drawing 'Q'
# Draw Q
from tkinter import *  

app=Tk()  
app.title("Q")  
 
canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)

canvas.create_oval(100,100,300,300,width=5)
canvas.create_line(240,250,340,300,width=5)

app.mainloop()


   Python code for drawing 'R'
# Draw R
from tkinter import *  

app=Tk()  
app.title("R")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=500,height=500)  

c= 410, 20, 170, 180
arc = canvas.create_arc(c, start=90, extent=-180, fill="", width=5)
canvas.create_line(290,70,290,380,width=5)
canvas.create_line(290,180,430,380,width=5)

app.mainloop()


   Python code for drawing 'S'
# Draw S
from tkinter import * 
 
app=Tk()  
app.title("S")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=300,height=300)  

x1=50
canvas.create_arc(x1,x1,x1+100,x1+100, start=50,extent=220,outline="black",width=5, style="arc")
canvas.create_arc(x1,x1+100,x1+100,x1+200, start=95,extent=-240,outline="black",width=5, style="arc") 
  
app.mainloop()


   Python code for drawing 'T'
# Draw T
from tkinter import *  

app=Tk()  
app.title("T")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=480,height=300)  

canvas.create_line(190,70,190,340,width=5) 
canvas.create_line(100,70,280,70,width=5)

app.mainloop()


   Python code for drawing 'U'
# Draw U
from tkinter import *  

app=Tk()   
app.title("U")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)

canvas.create_line(200,70,200,300,width=5)
canvas.create_line(50,70,50,300,width=5)  
c= 200,350,50,240
arc=canvas.create_arc(c,start=0,extent=-180,fill="",style="arc",width=5)                            

app.mainloop()


   Python code for drawing 'V'
# Draw V
from tkinter import *  

app=Tk()   
app.title("V")  
  
canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=300,height=300)  

canvas.create_line(50,7,120,200,width=5)
canvas.create_line(200,7,120,200,width=5)

app.mainloop()



   Python code for drawing 'W'
# Draw W
from tkinter import *  

app=Tk()  
app.title("W")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)  

canvas.create_line(50,50,80,200,width=5)
canvas.create_line(80,200,175,80,width=5)
canvas.create_line(175,80,280,200,width=5)
canvas.create_line(280,200,300,50,width=5)

app.mainloop()


   Python code for drawing 'X'
# Draw X
from tkinter import *  

app=Tk()   
app.title("X")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)

canvas.create_line(100,70,280,380,width=5)
canvas.create_line(280,70,100,380,width=5)

app.mainloop()


   Python code for drawing 'Y'
# Draw Y
from tkinter import *  

app=Tk()   
app.title("Y")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=400,height=400)

canvas.create_line(70,100,185,230,width=5)
canvas.create_line(300,100,185,230,width=5)
canvas.create_line(185,230,185,400,width=5)

app.mainloop()


   Python code for drawing 'Z'
# Draw Z
from tkinter import *  

app=Tk()  
app.title("Z")  

canvas=Canvas(app)  
canvas.pack()  
canvas.config(width=300,height=300)  

x=100
canvas.create_line(x,x,x+100,x, fill='black',width=5) 
canvas.create_line(x+100,x,x,x+150, fill='black',width=5)
canvas.create_line(x,x+150,x+100,x+150, fill='black',width=5)

app.mainloop()

No comments:

Post a Comment