ชิ้นงานภาษาไพทอน gui

ชิ้นงาน รายงาน โปรเเกรมการคำนวณพื้นที่และปริมาตรต่างๆ ภาษาไพทอน (python gui)

ชิ้นงาน รายงาน โปรเเกรมการคำนวณพื้นที่และปริมาตรต่างๆ ภาษาไพทอน (python gui)

ผลลัพธ์ที่เกิดขึ้นจากการเรียนในรายวิชาการเขียนโปรแกรม 2 รหัสวิชา ว30297 ระดับชั้นมัธยมศึกษาปีที่ 5 ห้อง 7 ชื่อโปรเเกรมการคำนวณพื้นที่และปริมาตรต่างๆ ผู้จัดทำ

  1. นางสาวเขมจิรา ทวีวัฒนานนท์ รหัสนักเรียน 37131
  2. นางสาวธัญสุดา ชัยทน รหัสนักเรียน 37138
  3. นางสาวภัทรภร  ศิวศิษย  รหัสนักเรียน 39436

ครูผู้สอนนายวุฒิชัย  แม้นรัมย์  กลุ่มสาระการเรียนรู้วิทยาศาสตร์และเทคโนโลยี


รายงานเล่มนี้จัดทำขึ้นเพื่อแสดงให้เห็นถึงผลลัพธ์ที่เกิดขึ้นจากการเรียนใน รายวิชาการเขียนโปรแกรม 2 รหัสวิชา ว30291 ซึ่งเรียนด้วยภาษา Python ด้วยรูปแบบการเรียนในรูปแบบออนไลน์ และมีการปฏิบัติงาน เป็นกลุ่ม กลุ่มละ 3-4 คน ผลที่เกิดจากการเรียนด้วยรูปแบบการสอนที่มีประสิทธิภาพ ส่งผลให้นักเรียนสามารถ เขียนโปรแกรมออกมาได้เป็นรูปธรรมที่ชัดเจน มีความเข้าใจในชุดคำสั่งต่าง ๆ ที่ได้เขียนขึ้นมา
ขอขอบคุณผู้ที่สนใจศึกษาเนื้อหาจากเอกสารรายงานเล่มนี้ และหวังเป็นอย่างยิ่งว่ารายงานเล่มนี้จะเกิดประโยชน์ต่อผู้ที่สนใจศึกษา ขอขอบคุณ ครูวุฒิชัย แม้นรัมย์ ครูกลุ่มสาระการเรียนรู้วิทยาศาสตร์และเทคโนโลยี โรงเรียนธัญบุรี หากรายงานมีข้อผิดพลาดประการใด ผู้จัดทำขอน้อมรับไว้และขออภัยมา ณ ที่นี้ด้วย


ชุดโค้ดคำสั่งโปรเเกรมการคำนวณพื้นที่และปริมาตรต่าง ๆ ภาษาไพทอน (python gui)

 

from tkinter import*
g3=Tk()
g3.title("โปรเเกรมการคำนวณพื้นที่และปริมาตรต่างๆ")
g3.option_add("*Font","K2D")
g3.configure(background="#D3E0EA")
g3.geometry("720x480")   
def click1 ():
    nw1 =Tk()
    nw1.title("พื้นที่สี่เหลี่ยมจตุรัส")
    nw1.option_add("*Font","K2D 25")
    nw1.configure(background="#C1B2C6")
    nw1.geometry("500x390")
    Label(nw1,text="คำนวณหาพื้นที่สี่เหลี่ยมจตุรัส",font=60,bg="#C1B2C6").grid(row=0,column=1,padx=10,pady=10)
    i1=IntVar()
    Label(nw1,text='ความยาวด้าน(cm.)',font=60,bg="#C1B2C6").grid(row=1,column=0,padx=3,pady=3)
    e1=Entry(nw1,width=10,textvariable=i1)
    e1.grid(row=1,column=1,padx=3,pady=3)
    Label(nw1,text="ผลลัพธ์",font=60,bg="#C1B2C6").grid(row=3,column=0,padx=4,pady=4)    
    def n1():
        x1=float(e1.get())
        x10=x1*x1
        Label(nw1,text=x10,font=60).grid(row=3,column=1,padx=3,pady=3)
    def d1():
        e1.delete(0,END)
        Label(nw1,text="                                                     ",font=60,bg="#C1B2C6").grid(row=3,column=1,padx=3,pady=3)
    Button(nw1,text='คำนวณ',bg='#E7D2EF',command=n1).grid(row=4,column=0,padx=5,pady=5)
    Button(nw1,text='ลบข้อมูล',bg='#E7D2EF',command=d1).grid(row=4,column=1,padx=5,pady=5)
def click2 ():
    nw2 =Tk()
    nw2.title("พื้นที่สี่เหลี่ยมผืนผ้า")
    nw2.option_add("*Font","K2D 25")
    nw2.configure(background="#C1B2C6")
    nw2.geometry("500x390")
    Label(nw2,text="คำนวณหาพื้นที่สี่เหลี่ยมผืนผ้า",font=60,bg="#C1B2C6").grid(row=0,column=1,padx=10,pady=10)
    i3=IntVar()
    Label(nw2,text='ความยาวกว้าง(cm.)',font=60,bg="#C1B2C6").grid(row=1,column=0,padx=3,pady=3)
    e3=Entry(nw2,width=10,textvariable=i3)
    e3.grid(row=1,column=1,padx=3,pady=3)
    i4=IntVar()
    Label(nw2,text='ความยาวยาว(cm.)',font=60,bg="#C1B2C6").grid(row=2,column=0,padx=3,pady=3)
    e4=Entry(nw2,width=10,textvariable=i4)
    e4.grid(row=2,column=1,padx=1,pady=3)
    Label(nw2,text="ผลลัพธ์",font=60,bg="#C1B2C6").grid(row=3,column=0,padx=4,pady=4)    
    def n2():
        x3=float(e3.get())
        x4=float(e4.get())
        x34=x3*x4
        Label(nw2,text=x34,font=604).grid(row=3,column=1,padx=3,pady=3)
    def d2():
        e3.delete(0,END)
        e4.delete(0,END)        
        Label(nw2,text="                                                      ",font=60,bg="#C1B2C6").grid(row=3,column=1,padx=3,pady=3)        
    Button(nw2,text='คำนวณ',bg='#E7D2EF',command=n2).grid(row=4,column=0,padx=5,pady=5)
    Button(nw2,text='ลบข้อมูล',bg='#E7D2EF',command=d2).grid(row=4,column=1,padx=5,pady=5)    
def click3 ():
    nw3 =Tk()
    nw3.title("พื้นที่สี่เหลี่ยมด้านขนาน")
    nw3.option_add("*Font","K2D 25")
    nw3.configure(background="#C1B2C6")
    nw3.geometry("500x390")
    Label(nw3,text="คำนวณหาพื้นที่สี่เหลี่ยมด้านขนาน",font=60,bg="#C1B2C6").grid(row=0,column=1,padx=10,pady=10)
    i5=IntVar()
    Label(nw3,text='ความยาวฐาน(cm.)',font=60,bg="#C1B2C6").grid(row=1,column=0,padx=3,pady=3)
    e5=Entry(nw3,width=10,textvariable=i5)
    e5.grid(row=1,column=1,padx=3,pady=3)
    i6=IntVar()
    Label(nw3,text='ความยาวสูง(cm.)',font=60,bg="#C1B2C6").grid(row=2,column=0,padx=3,pady=3)
    e6=Entry(nw3,width=10,textvariable=i6)
    e6.grid(row=2,column=1,padx=1,pady=3)
    Label(nw3,text="ผลลัพธ์",font=60,bg="#C1B2C6").grid(row=3,column=0,padx=4,pady=4)    
    def n3():
        x5=float(e5.get())
        x6=float(e6.get())
        x56=x5*x6
        Label(nw3,text=x56,font=60).grid(row=3,column=1,padx=3,pady=3)
    def d3():
        e5.delete(0,END)
        e6.delete(0,END)        
        Label(nw3,text="                                                      ",font=60,bg="#C1B2C6").grid(row=3,column=1,padx=3,pady=3)        
    Button(nw3,text='คำนวณ',bg='#E7D2EF',command=n3).grid(row=4,column=0,padx=5,pady=5)
    Button(nw3,text='ลบข้อมูล',bg='#E7D2EF',command=d3).grid(row=4,column=1,padx=5,pady=5)    
def click4 ():
    nw4 =Tk()
    nw4.title("พื้นที่สามเหลี่ยมด้านเท่า")
    nw4.option_add("*Font","K2D 25")
    nw4.configure(background="#C1B2C6")
    nw4.geometry("500x390")
    Label(nw4,text="คำนวณหาพื้นที่สามเหลี่ยมด้านเท่า",font=60,bg="#C1B2C6").grid(row=0,column=1,padx=10,pady=10)
    i7=IntVar()
    Label(nw4,text='ความยาวฐาน(cm.)',font=60,bg="#C1B2C6").grid(row=1,column=0,padx=3,pady=3)
    e7=Entry(nw4,width=10,textvariable=i7)
    e7.grid(row=1,column=1,padx=3,pady=3)
    i8=IntVar()
    Label(nw4,text='ความยาวสูง(cm.)',font=60,bg="#C1B2C6").grid(row=2,column=0,padx=3,pady=3)
    e8=Entry(nw4,width=10,textvariable=i8)
    e8.grid(row=2,column=1,padx=1,pady=3)
    Label(nw4,text="ผลลัพธ์",font=60,bg="#C1B2C6").grid(row=3,column=0,padx=4,pady=4)    
    def n4():
        x7=float(e7.get())
        x8=float(e8.get())
        x78=x7*x8*0.5
        Label(nw4,text=x78,font=60).grid(row=3,column=1,padx=3,pady=3)
    def d4():
        e7.delete(0,END)
        e8.delete(0,END)        
        Label(nw4,text="                                                      ",font=60,bg="#C1B2C6").grid(row=3,column=1,padx=3,pady=3)        
    Button(nw4,text='คำนวณ',bg='#E7D2EF',command=n4).grid(row=4,column=0,padx=5,pady=5)
    Button(nw4,text='ลบข้อมูล',bg='#E7D2EF',command=d4).grid(row=4,column=1,padx=5,pady=5)   
def click5 ():
    nw5 =Tk()
    nw5.title("พื้นที่ปริมาตรปริซึมรูปสี่เหลี่ยม")
    nw5.option_add("*Font","K2D 25")
    nw5.configure(background="#C1B2C6")
    nw5.geometry("500x390")
    Label(nw5,text="คำนวณหาปริมาตรปริซึมรูปสี่เหลี่ยม",font=60,bg="#C1B2C6").grid(row=0,column=1,padx=10,pady=10)
    i9=IntVar()
    Label(nw5,text='ความยาวพื้นที่ฐาน(cm.)',font=60,bg="#C1B2C6").grid(row=1,column=0,padx=3,pady=3)
    e9=Entry(nw5,width=10,textvariable=i9)
    e9.grid(row=1,column=1,padx=3,pady=3)
    i10=IntVar()
    Label(nw5,text='ความยาวสูง(cm.)',font=60,bg="#C1B2C6").grid(row=2,column=0,padx=3,pady=3)
    e10=Entry(nw5,width=10,textvariable=i10)
    e10.grid(row=2,column=1,padx=1,pady=3)
    Label(nw5,text="ผลลัพธ์",font=60,bg="#C1B2C6").grid(row=3,column=0,padx=4,pady=4)    
    def n5():
        x9=float(e9.get())
        x10=float(e10.get())
        x910=x9*x10
        Label(nw5,text=x910,font=60).grid(row=3,column=1,padx=3,pady=3)
    def d5():
        e9.delete(0,END)
        e10.delete(0,END)
        Label(nw5,text="                                                      ",font=60,bg="#C1B2C6").grid(row=3,column=1,padx=3,pady=3)        
    Button(nw5,text='คำนวณ',bg='#E7D2EF',command=n5).grid(row=4,column=0,padx=5,pady=5)
    Button(nw5,text='ลบข้อมูล',bg='#E7D2EF',command=d5).grid(row=4,column=1,padx=5,pady=5)    
def click6 ():
    nw6 =Tk()
    nw6.title("พื้นที่วงกลม")
    nw6.option_add("*Font","K2D 25")
    nw6.configure(background="#C1B2C6")
    nw6.geometry("500x390")
    Label(nw6,text="คำนวณหาพื้นที่วงกลม",font=60,bg="#C1B2C6").grid(row=0,column=1,padx=10,pady=10)
    i11=IntVar()
    Label(nw6,text='ความยาวรัศมีวงกลม(cm.)',font=60,bg="#C1B2C6").grid(row=1,column=0,padx=3,pady=3)
    e11=Entry(nw6,width=10,textvariable=i11)
    e11.grid(row=1,column=1,padx=3,pady=3)
    Label(nw6,text="ผลลัพธ์",font=60,bg="#C1B2C6").grid(row=3,column=0,padx=4,pady=4)
    def n6():
        x11=float(e11.get())
        x1100=3.14*x11**2
        Label(nw6,text=x1100,font=60).grid(row=3,column=1,padx=3,pady=3)
    def d6():
        e11.delete(0,END)
        Label(nw6,text="                                                      ",font=60,bg="#C1B2C6").grid(row=3,column=1,padx=3,pady=3)        
    Button(nw6,text='คำนวณ',bg='#E7D2EF',command=n6).grid(row=4,column=0,padx=5,pady=5)
    Button(nw6,text='ลบข้อมูล',bg='#E7D2EF',command=d6).grid(row=4,column=1,padx=5,pady=5)    
Label(g3,text="click ที่รูปภาพ",font=60,bg="#D3E0EA").grid(row=0,column=1,padx=10,pady=10)
photo1=PhotoImage(file="ac.png")
Button(g3,image=photo1,bg="#D9F1F1",command=click1).grid(row=1,column=0,padx=5,pady=5)
Label(g3,text="สี่เหลี่ยมจตุรัส",font=35,bg="#D3E0EA").grid(row=2,column=0,padx=5,pady=5)
photo2=PhotoImage(file="aa.png")
Button(g3,image=photo2,bg="#D9F1F1",command=click2).grid(row=1,column=1,padx=5,pady=5)
Label(g3,text="สี่เหลี่ยมผืนผ้า",font=35,bg="#D3E0EA").grid(row=2,column=1,padx=5,pady=5)
photo3=PhotoImage(file="ab.png")
Button(g3,image=photo3,bg="#D9F1F1",command=click3).grid(row=1,column=2,padx=5,pady=5)
Label(g3,text="สี่เหลี่ยมด้านขนาน",font=35,bg="#D3E0EA").grid(row=2,column=2,padx=5,pady=5)
photo4=PhotoImage(file="ad.png")
Button(g3,image=photo4,bg="#D9F1F1",command=click4).grid(row=3,column=0,padx=5,pady=5)
Label(g3,text="สามเหลี่ยมด้านเท่า",font=35,bg="#D3E0EA").grid(row=4,column=0,padx=5,pady=5)
photo5=PhotoImage(file="af.png")
Button(g3,image=photo5,bg="#D9F1F1",command=click5).grid(row=3,column=1,padx=5,pady=5)
Label(g3,text="ปริซึมรูปสี่เหลี่ยม",font=35,bg="#D3E0EA").grid(row=4,column=1,padx=5,pady=5)
photo6=PhotoImage(file="ae.png")
Button(g3,image=photo6,bg="#D9F1F1",command=click6).grid(row=3,column=2,padx=5,pady=5)
Label(g3,text="วงกลม",font=35,bg="#D3E0EA").grid(row=4,column=2,padx=5,pady=5)
g3.mainloop()

ดาวน์โหลดไฟล์ >>> ชุดโค้ดคำสั่งโปรเเกรมการคำนวณพื้นที่และปริมาตรต่าง ๆ ภาษาไพทอน (python gui)

ใส่ความเห็น

อีเมลของคุณจะไม่แสดงให้คนอื่นเห็น ช่องข้อมูลจำเป็นถูกทำเครื่องหมาย *