0

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.root.wm_resizable(0,0)
        self.frame = Frame(root, background="blue")
        self.frame.pack()

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


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

        self.root.mainloop()

if __name__ == '__main__':
    App()
3
Contributors
2
Replies
5
Views
2 Years
Discussion Span
Last Post by woooee
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.