Member Avatar for rbyrd

I'm trying to write a program in which a message box is to appear on the application window when the application is launched. The code below produces the message box, but it appears as a separate window that is not over the application window. Is there a way to fix this? Ideally I would like to make it so that the user cannot move the message box off the application window. I'm using python 2.7.6 on OSX 10.6.8. Thanks.

from Tkinter import *
import tkMessageBox

class App:

    def __init__(self):

        self.root = Tk()
        self.frame = Frame(root, background="blue")

        self.cnvsHt = 800
        self.cnvsWdth = 800
        self.cnvs = Canvas(self.frame, width=self.cnvsWdth, height=self.cnvsHt, background = "#faf0e6")

        tkMessageBox.showwarning('TEST', 'This is a test', parent =self.frame)


if __name__ == '__main__':

Recommended Answers

All 2 Replies

You might want to replace the messagebox with a label of your own design.

Or put it in a Toplevel which can be positioned and sized.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.