Skip to content

unit9-tkinter-9.1-9.06 #10

@neuronfuzzy

Description

@neuronfuzzy

ตัวอย่าง tkinter แบบต่างๆ

messagebox.py
Ex09-01.py

from tkinter import *

root = Tk()
root.title("GUI Example by ajรติวัฒน์")
root.geometry("300x250")
root.option_add('*font', 'Comic Sans MS 14 bold italic')
root.mainloop() 

Ex09-02.py

#windows GUI tkinter background #B63C95
from tkinter import *

root = Tk()
root.title("GUI Example by ajRatiwat")
root.geometry("400x350")
root.option_add('*font', 'Comic Sans MS 10 bold')
frame = Frame(root)
frame.config(background="#B63C95")
frame.place(width=400, height=350, x=0, y=0)
root.mainloop()
Image

Ex09-03.py

#windows GUI tkinter background #45B83F + button
#windows GUI tkinter background #45B83F + button
from tkinter import *

root = Tk()
root.title("GUI by ajRatiwat")
root.geometry("300x250")
root.option_add('*font', 'tahoma 16 bold')
frame = Frame(root)
frame.config(background="#45B83F")
frame.place(width=300, height=250, x=0, y=0)

button1 = Button(frame, text="ปุ่มที่1", width=12, height=2,foreground = "red")
button1.pack(padx=30, pady=30)
image1 = PhotoImage(file="./book.gif")
button2 = Button(frame, image=image1, text="กดปุ่มนี้", width="100", height=30, compound="left", bg="white", foreground="blue")
button2.pack(padx=30, pady=30)
root.mainloop()

output

Image

Ex09-04.py

from tkinter import *

root = Tk()
root.title("GUI App ajratiwat-ex9-04")
root.geometry("300x250")
root.option_add('*font', 'Sarabun 10 bold')
frame = Frame(root)
frame.config(background="cyan")
frame.place(width=300, height=250, x=0, y=0)
photo=PhotoImage(file="./22.gif")
label1 = Label(frame, image=photo, text="Label1", width="80", height=60, compound="top", bg="white")
label1.grid(column=1, row=0, padx=15, pady=15)
label2 = Label(frame, text="Label2", width=10, anchor=W)
label2.grid(column=0, row=1, padx=15, pady=15)
message3 = Message(frame, text="How are you today? ฉันหลับสบายดี เพราะฝนตก บายๆๆๆๆ.", width=80, anchor=W, bg="yellow")
message3.grid(column=1, row=1, padx=15, pady=15)
root.mainloop()

Ex09-05.py

Image
Ex09-09.py
Ex09-08.py
Ex09-07.py
Ex09-06.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions