मान लीजिए कि हम टिंकर का उपयोग करके एक डायलॉग बॉक्स बनाना चाहते हैं। डायलॉग बॉक्स बनाने के लिए हम MessageBox लाइब्रेरी का उपयोग कर सकते हैं जिसमें डायलॉग टाइप जल्दी से बनाने के लिए कई फंक्शन शामिल हैं।
बनाए गए डायलॉग बॉक्स की स्थिति को समायोजित करने के लिए, हम इसकी "टॉपलेवल" संपत्ति का उपयोग कर सकते हैं जो मूल रूप से वर्तमान बॉक्स को प्राथमिकता देता है और अन्य सभी प्रक्रियाओं को बैकएंड में रखता है।
इसमें शीर्षक, संदेश और विवरण जैसे कुछ अन्य कार्य शामिल हैं। MessageBox विजेट की स्थिति बदलने के लिए, हम ज्यामिति . का उपयोग करेंगे विधि।
उदाहरण
#import the tkinter library
from tkinter import *
#define the messagebox function
def messagebox():
#toplevel function creates MessageBox dialog which appears on top of the screen
top=Toplevel(win)
top.title("Click Me")
#Define the position of the MessageBox
x_position = 600
y_position = 400
top.geometry(f"600x200+{x_position}+{y_position}")
#Define the property of the messageBox
l1=Label(top, text= "Hello! TutorialsPoint",bg= "green", fg=
"white",font=('Times New Roman', 24),height=50, width= 50).pack()
#Create an instance of the tkinter frame
#And resize the frame
win = Tk()
win.geometry("600x200")
win.title("Window-1")
Button(win, text="Click Me", command=messagebox,
width=8).pack(pady=80)
win.mainloop() आउटपुट
उपरोक्त कोड को चलाने से निम्न आउटपुट विंडो उत्पन्न होगी।

जब आप "क्लिक मी" बटन पर क्लिक करते हैं, तो यह निम्नलिखित डायलॉग बॉक्स खोलेगा जिसे बाद में पोजिशन किया जा सकता है।
