Tkinter, and calling other classes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phoenix1990
    New Member
    • May 2009
    • 18

    #16
    ok, so i've pretty much finished everything, but i'm having a little problem with creating a popup dialog box.
    i've defined a new class called DialogBox which looks like this
    Code:
    class DiaglogBox:
        def __init__(self, master):
            if self.entryframe.win==True:
                self.win()
            else:
                self.lose()
    however every time i try to call that function(self.d ialogbox=Dialog Box(None)) in another class i keep getting the error.
    global name 'DialogBox' is not defined

    Comment

    • boxfish
      Recognized Expert Contributor
      • Mar 2008
      • 469

      #17
      DialogBox needs to inherit from the Frame class. Make it
      Code:
      class DialogBox(Frame):
      Also, if it's a dialog box, you need to tell it which window is its parent. When you create a DialogBox object, pass it its parent window instead of None.
      Let me know whether this works.

      Comment

      • phoenix1990
        New Member
        • May 2009
        • 18

        #18
        Originally posted by boxfish
        DialogBox needs to inherit from the Frame class. Make it
        Code:
        class DialogBox(Frame):
        Also, if it's a dialog box, you need to tell it which window is its parent. When you create a DialogBox object, pass it its parent window instead of None.
        Let me know whether this works.
        IT WORKED!!! and i'm finally finished with all the stuff i needed to do. thanks for all your help during the past week boxfish. you saved me a lot of time and stress.

        Comment

        Working...