การใช้งาน Python GUI (Tkinter) : การเรียกใช้ Font

แชร์ความรู้ภาษา Python ไพทอน การเขียนโปรแกรมภาษาไพทอน

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
Jom07
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 514
ลงทะเบียนเมื่อ: 08/01/2018 9:56 am

การใช้งาน Python GUI (Tkinter) : การเรียกใช้ Font

โพสต์ที่ยังไม่ได้อ่าน โดย Jom07 »

การใช้งาน Python GUI (Tkinter) : การเรียกใช้ Font เป็นการเลือกใช้ font ต่าง ๆ เช่น

โค้ด: เลือกทั้งหมด

from Tkinter import *

root = Tk()

def window(main):
    main.title('Out Program')
    main.update_idletasks()
    width = 300
    height = 300
    x = (main.winfo_screenwidth() // 2)-(width // 2)
    y = (main.winfo_screenheight() // 2)-(height // 2)
    main.geometry('{}x{}+{}+{}'.format(width, height, x, y))

def main_content():
    hello = Label(root, text= 'MD Soft ', font='times 24')
    hello.pack()

window(root)
main_content()
mainloop()
รูปภาพ

โค้ด: เลือกทั้งหมด

from Tkinter import *

root = Tk()

def window(main):
    main.title('Out Program')
    main.update_idletasks()
    width = 300
    height = 300
    x = (main.winfo_screenwidth() // 2)-(width // 2)
    y = (main.winfo_screenheight() // 2)-(height // 2)
    main.geometry('{}x{}+{}+{}'.format(width, height, x, y))

def main_content():
    hello = Label(root, text= 'MD Soft ', font='times 24 bold')
    hello.pack()

window(root)
main_content()
mainloop()
รูปภาพ

โค้ด: เลือกทั้งหมด

from Tkinter import *

root = Tk()

def window(main):
    main.title('Out Program')
    main.update_idletasks()
    width = 300
    height = 300
    x = (main.winfo_screenwidth() // 2)-(width // 2)
    y = (main.winfo_screenheight() // 2)-(height // 2)
    main.geometry('{}x{}+{}+{}'.format(width, height, x, y))

def main_content():
    hello = Label(root, text= 'MD Soft ', font='times 24 bold italic')
    hello.pack()

window(root)
main_content()
mainloop()
รูปภาพ

โค้ด: เลือกทั้งหมด

from Tkinter import *

root = Tk()

def window(main):
    main.title('Out Program')
    main.update_idletasks()
    width = 300
    height = 300
    x = (main.winfo_screenwidth() // 2)-(width // 2)
    y = (main.winfo_screenheight() // 2)-(height // 2)
    main.geometry('{}x{}+{}+{}'.format(width, height, x, y))

def main_content():
    hello = Label(root, text= 'MD Soft ', font='times 24 bold italic underline')
    hello.pack()

window(root)
main_content()
mainloop()
รูปภาพ

โค้ด: เลือกทั้งหมด

from Tkinter import *

root = Tk()

def window(main):
    main.title('Out Program')
    main.update_idletasks()
    width = 300
    height = 300
    x = (main.winfo_screenwidth() // 2)-(width // 2)
    y = (main.winfo_screenheight() // 2)-(height // 2)
    main.geometry('{}x{}+{}+{}'.format(width, height, x, y))

def main_content():
    hello = Label(root, text= 'MD Soft ', font='times 24 bold italic underline', fg='#001dff', bg='#ffe500')
    hello.pack()

window(root)
main_content()
mainloop()
รูปภาพ
รูปภาพ
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 81