<div>Thanks a lot.</div>
<div>It was quick.</div>
<div>I will send the traceback from now on.</div>
<div>&nbsp;</div>
<div>-Asrar<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 10/13/06, <b class="gmail_sendername">Luke Paireepinart</b> &lt;<a href="mailto:rabidpoobear@gmail.com">rabidpoobear@gmail.com</a>&gt; 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>&gt;<br>&gt;<br>&gt; I have created two buttons. The code for button2 is not working as I
<br>&gt; want it to be. When I click button2, the application should exit, but<br>&gt; it isnt.<br>&gt; Can someone fix it??<br>&gt;<br>&gt; from Tkinter import *<br>&gt; from tkMessageBox import *<br>&gt;<br>&gt; def callback():
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; showinfo('message','I am here...')<br>&gt;<br>&gt; def QUIT():<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; ans = askyesno('Confirm','Do you really want to quit?')<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; if ans:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root.exit<br>&gt;<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 &quot;C:\Python24\lib\lib-tk\Tkinter.py&quot;, line 1345, in __call__<br>&nbsp;&nbsp; return self.func(*args)<br>File &quot;C:/Python24/temp.py&quot;, line 10, in QUIT<br>&nbsp;&nbsp; root.exit<br>File &quot;C:\Python24\lib\lib-tk\Tkinter.py&quot;, line 1654, in __getattr__
<br>&nbsp;&nbsp; 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,&nbsp;&nbsp;and it wasn't&nbsp;&nbsp;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.&nbsp;&nbsp;To the computer, 'exit' and 'quit'<br>mean something as different<br>as 'root beer' and 'trash can' would to us.&nbsp;&nbsp;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.