<div>Thanks a lot.</div>
<div>It was quick.</div>
<div>I will send the traceback from now on.</div>
<div> </div>
<div>-Asrar<br><br> </div>
<div><span class="gmail_quote">On 10/13/06, <b class="gmail_sendername">Luke Paireepinart</b> <<a href="mailto:rabidpoobear@gmail.com">rabidpoobear@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Asrarahmed Kadri wrote:<br>><br>><br>> I have created two buttons. The code for button2 is not working as I
<br>> want it to be. When I click button2, the application should exit, but<br>> it isnt.<br>> Can someone fix it??<br>><br>> from Tkinter import *<br>> from tkMessageBox import *<br>><br>> def callback():
<br>> showinfo('message','I am here...')<br>><br>> def QUIT():<br>> ans = askyesno('Confirm','Do you really want to quit?')<br>> if ans:<br>> root.exit<br>><br>SEND US THE TRACEBACK!!!! :)
<br>Don't just tell us that something doesn't work.<br>The traceback contains valuable information that tells you (or us) how<br>to debug it.<br>In this case,the traceback was<br>#//////<br>Exception in Tkinter callback<br>
Traceback (most recent call last):<br>File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__<br> return self.func(*args)<br>File "C:/Python24/temp.py", line 10, in QUIT<br> root.exit<br>File "C:\Python24\lib\lib-tk\Tkinter.py", line 1654, in __getattr__
<br> return getattr(<a href="http://self.tk">self.tk</a>, attr)<br>AttributeError: exit<br>#\\\\<br>Okay, so what do we see here?<br>Start reading from the bottom.<br>AttributeError: exit.<br>okay, so that means that we tried to access a method or a variable of a
<br>class, and it wasn't there.<br>It lacked that attribute.<br><br>Which class was it?<br>looking further up the stack, we see where we access 'exit.'<br>line 10, in QUIT:<br>root.exit<br><br>This means that whatever class root is an instance of doesn't have a
<br>method named exit.<br><br>Remember, the computer is stupid. To the computer, 'exit' and 'quit'<br>mean something as different<br>as 'root beer' and 'trash can' would to us. The method you're trying to<br>access is called 'quit', not 'exit'
<br>That's your first problem.<br><br>The second problem you have, is that you're not calling this method,<br>you're just accessing it, which doesn't really do anything.<br>What you'll want to do is<br>root.quit()<br><br>
and not<br>root.quit<br><br>HTH,<br>-Luke<br></blockquote></div><br><br clear="all"><br>-- <br>To HIM you shall return.