หน้า 1 จากทั้งหมด 1

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

โพสต์แล้ว: 06/03/2018 4:33 pm
โดย 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()
รูปภาพ