<div>I am trying to create a GUI that will display a new window with information about my program when the user clicks on the info button (a green "i" bitmap). So far all I can get my program to do is show the new window (using Toplevel() ) when the program loads, not when the user presses the information bitmap. I think it has something to do with my command for the information button. Anyone have any ideas or have a GOOD resource that they could point me to?
</div>
<div> </div>
<div>Thanks</div>
<div> </div>
<div>
<p>from Tkinter import *</p>
<p>class Application(Frame):<br>  """ A GUI application with three buttons. """<br>  <br>  def __init__(self, master):<br>    """ Initialize the Frame. """<br>    Frame.__init__(self,master)
<br>    self.grid()<br>    self.create_widgets()<br>   <br>  def update_text(self):<br>    message = self.toolbar.get()<br>    self.results.delete(0.0, END)<br>    self.results.insert(0.0, message)<br>    <br>  def create_widgets(self):
<br>    # create variable for single toolbar selection<br>    self.toolbar = StringVar()<br>    <br>    """Create button, text and entry widgets. """<br>    #create welcome text<br>    welcome = Label(self)
<br>    welcome["text"] = "You are now about to run Automation Testing.\n"\<br>    "Please check the toolbar to be tested and then select\n"\<br>    "the test you would like to perform."
<br>    <br>    welcome.grid(row = 0, column = 0, columnspan = 3, sticky = W)<br>    <br>    #create Upr Radio<br>    Radiobutton(self, text = "Upr", variable = self.toolbar,<br>                value = "upr", command = 
self.update_text).grid(row = 1, column = 0, sticky = W)<br>    <br>    #create Com Radio<br>    Radiobutton(self, text = "Com", variable = self.toolbar,<br>                value = "com", command = self.update_text
).grid(row = 1, column = 1, sticky = W)<br>    <br>    #create CI Radio<br>    Radiobutton(self, text = "CI", variable = self.toolbar,<br>                value = "ci", command = self.update_text).grid(row = 1, column = 2, sticky = W)
<br>                <br>    #create text box<br>    self.results = Text(self, width = 40, height = 4, wrap = WORD)<br>    self.results.grid(row = 2, column = 0, columnspan = 3, sticky = W)    <br>    <br>    #create Performance button
<br>    self.perf_bttn = Button(self)<br>    self.perf_bttn["text"] = "Performance"<br>    self.perf_bttn["command"] = self.perf<br>    self.perf_bttn.grid(row = 3, column = 0, sticky = W) <br>
    message = self.toolbar.get()<br>    <br>    #create PII button<br>    self.pii_bttn = Button(self)<br>    self.pii_bttn["text"] = "PII"<br>    self.pii_bttn.grid(row = 3, column = 1, sticky = W)<br>
    <br>    #create info button<br>    self.info_bttn = Button(self)<br>    self.info_bttn["fg"] = "green"<br>    self.info_bttn["bitmap"] = "info"<br>    self.info_bttn.command = self.info
()<br>    self.info_bttn.grid(row = 3, column = 2, sticky = W)<br>    <br>    #create exit button<br>    self.exit_bttn = Button(self)<br>    self.exit_bttn["fg"] = "red"<br>    self.exit_bttn["cursor"] = "pirate"
<br>    self.exit_bttn["text"] = "EXIT"<br>    self.exit_bttn["command"] = root.quit<br>    self.exit_bttn.grid(row = 3, column = 3, sticky = W)<br>  <br>  def perf(self):<br>    import performance
<br>    performance.perf(self.toolbar.get())</p>
<p>    <br>  def info(self):<br>    # create child window <br>    win = Toplevel()<br>    <br>    <br>    <br>    <br>  <br># main<br>root = Tk()<br>root.title("Automation Testing")<br>app = Application(root)<br>
root.mainloop()</p></div>