Tkinter एक GUI- आधारित पायथन पुस्तकालय है जिसका उपयोग विभिन्न प्रकार के कार्यात्मक और GUI- आधारित अनुप्रयोगों को विकसित करने के लिए किया जाता है। यह बहुत सारे कार्य और विधियाँ प्रदान करता है जिनका उपयोग किसी एप्लिकेशन को विकसित करते समय एक्स्टेंसिबिलिटी और विभिन्न सुविधाएँ प्रदान करने के लिए किया जा सकता है।
इस लेख में, हम देखेंगे कि कैसे हम कर्सर संपत्ति का उपयोग करके टिंकर फ्रेम में एक बटन पर मँडराते हुए माउस कर्सर को बदल सकते हैं। टिंकर की बटन लाइब्रेरी में बहुत सारे कर्सर मानचित्र उपलब्ध हैं जो अंतिम उपयोगकर्ता के लिए अलग-अलग दृश्य प्रदान करते हैं। पुस्तकालय में कुछ कर्सर हैं,
"तीर"
"सर्कल"
"घड़ी"
"क्रॉस"
"डॉटबॉक्स"
"एक्सचेंज"
"फ़्लूर"
"दिल"
"दिल"
"आदमी"
"माउस"
"समुद्री डाकू"
"प्लस"
"शटल"
"साइज़िंग"
"मकड़ी"
"स्प्रेकेन"
"स्टार"
"लक्ष्य"
"टक्रॉस"
"ट्रेक"
"घड़ी"
आइए पहले कुछ बटन बनाएं और फिर हम इनमें से कुछ कर्सर माउस पॉइंटर पर लगाएंगे।
उदाहरण
from tkinter import *
#Create an instance of window or frame
win= Tk()
#Set the geometry
win.geometry("700x600")
win.resizable(0,0)
win.config(cursor= "fleur")
#Let us create a text label
Label(win, text= "Hover on each of these buttons", font=('Poppins', 20)).pack(pady=20)
#Create some buttons with cursor property
b1= Button(win, text= "Star",cursor="star")
b1.pack(pady=20)
b2= Button(win, text= "Arrow",cursor="arrow")
b2.pack(pady=20)
b3= Button(win, text= "Circle",cursor="circle")
b3.pack(pady=20)
b4= Button(win, text= "Clock",cursor="clock")
b4.pack(pady=20)
b5= Button(win, text= "Heart",cursor="heart")
b5.pack(pady=20)
b6= Button(win, text= "Man",cursor="man")
b6.pack(pady=20)
b7= Button(win, text= "Mouse",cursor="mouse")
b7.pack(pady=20)
#Keep Running the window
win.mainloop() आउटपुट
ऊपर दिए गए कोड को चलाने से अलग-अलग माउस पॉइंटर शेप वाले अलग-अलग बटन बनेंगे।
