मान लीजिए हम tkinter का उपयोग करके एक dialogue box बनाना चाहते हैं। Dialogue box बनाने के लिए हम MessageBox library का उपयोग कर सकते हैं जिसमें quickly dialogue types बनाने के लिए कई functions होते हैं।
बनाए गए Dialogue Box की position adjust करने के लिए, हम इसकी "toplevel" property का उपयोग कर सकते हैं जो basically current box को priority देती है और अन्य सभी processes को backend में रखती है।
इसमें title, message, और details जैसे कुछ अन्य functions होते हैं। MessageBox widget की position बदलने के लिए, हम geometry method का उपयोग करेंगे।
उदाहरण
# 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()
आउटपुट
उपरोक्त code चलाने से निम्न output window generate होगी।

जब आप "Click Me" button पर क्लिक करते हैं, तो यह निम्न dialogue box खोलेगा जिसे बाद में position किया जा सकता है।
