हम टिंकर पाठ का उपयोग कर सकते हैं टेक्स्ट डालने, जानकारी प्रदर्शित करने और टेक्स्ट . से आउटपुट प्राप्त करने के लिए विजेट विजेट। उपयोगकर्ता इनपुट को पाठ . में प्राप्त करने के लिए विजेट, हमें get() . का उपयोग करना होगा तरीका। आइए एक उदाहरण लेते हैं कि यह कैसे काम करता है।
उदाहरण
# Import the required library
from tkinter import *
from tkinter import ttk
# Create an instance of tkinter frame
win=Tk()
# Set the geometry
win.geometry("700x350")
def get_input():
label.config(text=""+text.get(1.0, "end-1c"))
# Add a text widget
text=Text(win, width=80, height=15)
text.insert(END, "")
text.pack()
# Create a button to get the text input
b=ttk.Button(win, text="Print", command=get_input)
b.pack()
# Create a Label widget
label=Label(win, text="", font=('Calibri 15'))
label.pack()
win.mainloop() आउटपुट
उपरोक्त कोड को चलाने से पाठ . के साथ एक विंडो प्रदर्शित होगी विजेट और आउटपुट को प्रिंट और प्रदर्शित करने के लिए एक बटन। जब आप टेक्स्ट विजेट में कुछ टाइप करते हैं और "प्रिंट" . पर क्लिक करते हैं बटन, यह आउटपुट को नीचे लेबल . में प्रदर्शित करेगा विजेट।
