Tkinter में, हम images का उपयोग करके buttons बना और customize कर सकते हैं। इन images को Python PhotoImage(file) फंक्शन का उपयोग करके upload किया जा सकता है।
हालांकि, PhotoImage() केवल कुछ image types जैसे PNG, PPM, और GIF support करता है। इसके अलावा, हम BitMap images का उपयोग करके भी buttons बना सकते हैं। Bitmap image डॉट्स का एक समूह है जो matrix में aligned होते हैं और image के pixel को represent करते हैं। Tkinter में निम्न प्रकार के bitmap attributes उपलब्ध हैं:
"error"
"gray75"
"gray50"
"gray25"
"gray12"
"hourglass"
"info"
"questhead"
"question"
"warning"
उदाहरण
from tkinter import *
# Create an instance of tkinter frame
win = Tk()
win.geometry("700x300")
win.resizable(0, 0)
Button(win, relief=RAISED, bitmap="info").pack(pady=10)
Button(win, relief=RAISED, bitmap="gray50").pack(pady=10)
Button(win, relief=RAISED, bitmap="gray25").pack(pady=10)
Button(win, relief=RAISED, bitmap="gray12").pack(pady=10)
Button(win, relief=RAISED, bitmap="questhead").pack(pady=10)
win.mainloop()
आउटपुट
उपरोक्त code चलाने से निम्नानुसार bitmap buttons बनेंगे:
