Pop up dialog from main app in Tkinter (python)

Discussion in 'General Computer Support' started by sreastman, Mar 21, 2013.

  1. sreastman

    sreastman

    Joined:
    Mar 21, 2013
    Messages:
    2
    Likes Received:
    0
    I'm am trying to create a pop up dialog in Tkinter from an application so that I can send values back from the dialog to the main screen.

    This is part of the code:

    from Tkinter import *
    import ttk
    class MainScreen:
    def __init__(self, master):
    self.master = master
    self.result="Untested"

    self.b = Button(master, text="Select Data", width=12)
    self.b.grid(row=0, column=0)
    self.b = Button(master, text="Select Learners", width=12, command=self.display_learner_options)
    self.b.grid(row=0, column=1)
    self.b = Button(master, text="Optimize",width=12)
    self.b.grid(row=0, column=2)
    self.b = Button(master, text="Save Results", width=12)
    self.b.grid(row=0, column=3)
    self.b = Button(master, text="Exit", width=12, command=quit)
    self.b.grid(row=0, column=4)
    self.t = Text(master, width=60, height=15)
    self.t.grid(row=1, columnspan=5)
    self.p = ttk.Progressbar(master)
    self.p.grid(row=2, columnspan=5)
    def display_learner_options(self):
    self.learnerOptions = LearnerOptions(self.master)
    class LearnerOptions(Toplevel):
    def __init__(self, parent):
    Toplevel.__init__(self, parent)
    self.transient(parent)
    self.parent = parent
    self.b = Button(self, text="Test")
    self.b.pack()
    # self.grab__set()
    self.initial_focus = self
    self.wait__window(self)
    def test(self):
    parent.result="Tested"
    self.destroy
    root = Tk()
    root.wm_title("Prediction Optimizer")
    mainScreen = MainScreen(root)
    root.mainloop()

    I get the following exception:

    LearnerOptions instance has no attribute wait_window

    What am I doing wrong or omitting?

    Thanks--Steve
     
    sreastman, Mar 21, 2013
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.