<br>hi,<br>Thanks for ur gr8 help.I solved that issue.Now one more problem has come up.that is first time when i click on quit menu item it is working properly,but when i click it for second time it is giving error.<br><b>error is</b> : &#39;NoneType&#39; object has no attribute &#39;show&#39;<br>
It is showing none type even though it is not none .<br><b>Here is my whole code :</b><br>#!/usr/bin/env python<br><br>import pygtk<br>pygtk.require(&#39;2.0&#39;)<br>import gtk <br>import gtk.glade<br>import new_org<br>class mainmenu:<br>
&nbsp;&nbsp;&nbsp; def show_newOrganisation(self,widget):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<a href="http://new_org.org">new_org.org</a>()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.gladefile_newOrg = &quot;new_org.glade&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.wTreenewOrg = gtk.glade.XML(self.gladefile_newOrg)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget(&quot;window_new_org&quot;)&nbsp;&nbsp; &nbsp;, None, 0)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.notebook.set_current_page(self.page)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; def dialogQuit(self,widget):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.dialog_quit = self.wTree.get_widget(&quot;dialog_quit&quot;)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.dialog_quit.show()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.response = self.dialog_quit.run()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;if self.response == 1:# I assigned 1 to quit and -1 to cancel in glade<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;gtk.main_quit()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;else:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;self.dialog_quit.destroy()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; #To quit the main window<br>&nbsp;&nbsp;&nbsp; def on_Mainwindow_destroy(self):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;gtk.main_quit()<br><br><br>&nbsp;&nbsp;&nbsp; def __init__(self):<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;#set the glade file<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.gladefile = &quot;gnukhata.glade&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.wTree = gtk.glade.XML(self.gladefile)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;#get the Main Window and connect the Destroy event<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.window = self.wTree.get_widget(&quot;MainWindow&quot;)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.window.show()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.window.connect(&#39;destroy&#39;,gtk.main_quit)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.notebook = self.wTree.get_widget(&quot;notebook_main&quot;) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.notebook.show()&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.menuitem_quit = self.wTree.get_widget(&quot;menuitem_quit&quot;)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.menuitem_quit.connect(&#39;activate&#39;,self.dialogQuit)<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.menuitem_newOrg = self.wTree.get_widget(&quot;menuitem_new_organisation&quot;)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;self.menuitem_newOrg.connect(&#39;activate&#39;,self.show_newOrganisation)<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>if __name__ == &quot;__main__&quot;:<br>&nbsp;&nbsp;&nbsp; mm=mainmenu()<br>&nbsp;&nbsp;&nbsp; gtk.main() <br><br>Thanks one again<br><br>Njoy the share of Freedom,<br>
Anusha<br><div class="gmail_quote">On Sat, Jan 10, 2009 at 2:05 PM, Andi Albrecht <span dir="ltr">&lt;<a href="mailto:albrecht.andi@googlemail.com">albrecht.andi@googlemail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
AFAIK there&#39;s not gtk.RESPONSE_QUIT response id. When you create the<br>
dialog in Glade you&#39;re able to define a response ID for a dialog<br>
button in the properties editor. The response ID should be an integer<br>
matching one of the response constants in the gtk module, e.g.<br>
<br>
&gt;&gt;&gt; import gtk<br>
&gt;&gt;&gt; int(gtk.RESPONSE_OK)<br>
-5<br>
&gt;&gt;&gt; int(gtk.RESPONSE_CANCEL)<br>
-6<br>
<br>
Hope that helps!<br>
<br>
Andi<br>
<div><div></div><div class="Wj3C7c"><br>
On Sat, Jan 10, 2009 at 9:05 AM, Miguel Ángel García<br>
&lt;<a href="mailto:magmaxlistas@gmail.com">magmaxlistas@gmail.com</a>&gt; wrote:<br>
&gt; Hello.<br>
&gt;<br>
&gt; I&#39;m not too sure, but I think that you have to compare with<br>
&gt; RESPONSE_CANCEL despite RESPONSE_QUIT. What I&#39;m sure is that you must<br>
&gt; quit the quotes, because it is a var, not a string.<br>
&gt;<br>
&gt; If I had had that problem, I had try to set a:<br>
&gt; print gtk.RESPONSE_QUIT, self.response<br>
&gt; between the &quot;run&quot; and the &quot;if&quot; statements, to see what is returning and<br>
&gt; why it is not entering in the condition.<br>
&gt;<br>
&gt; Good luck!<br>
&gt;<br>
&gt; El Sat, 10 Jan 2009 12:07:18 +0530<br>
&gt; &quot;anusha k&quot; &lt;<a href="mailto:anuhacks@gmail.com">anuhacks@gmail.com</a>&gt; escribió:<br>
&gt;<br>
&gt;&gt; hi,<br>
&gt;&gt; I am developing a account application .In &nbsp;that i added a quit dialog<br>
&gt;&gt; with a two stock buttons i.e quit and cancel.but when i triggered the<br>
&gt;&gt; quit button just closes the dialog not the main window .here is my<br>
&gt;&gt; code:<br>
&gt;&gt;<br>
&gt;&gt; def dialogQuit(self,widget):<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.dialog_quit = self.wTree.get_widget(&quot;dialog_quit&quot;)<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.dialog_quit.show()<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.response = self.dialog_quit.run()<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if self.response == &#39;gtk.RESPONSE_QUIT&#39;:<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gtk.main_quit()<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.dialog_quit.destroy() &lt;<a href="mailto:pygtk@daa.com.au">pygtk@daa.com.au</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; how to solve the issue<br>
&gt;&gt;<br>
&gt;&gt; Thanks in advance<br>
&gt;&gt;<br>
&gt;&gt; Njoy the share of Freedom,<br>
&gt;&gt; Anusha<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; In a world without walls and fences, who needs Windows and Gates?<br>
</div></div>&gt; _______________________________________________<br>
&gt; pygtk mailing list &nbsp; <a href="mailto:pygtk@daa.com.au">pygtk@daa.com.au</a><br>
&gt; <a href="http://www.daa.com.au/mailman/listinfo/pygtk" target="_blank">http://www.daa.com.au/mailman/listinfo/pygtk</a><br>
&gt; Read the PyGTK FAQ: <a href="http://faq.pygtk.org/" target="_blank">http://faq.pygtk.org/</a><br>
&gt;<br>
_______________________________________________<br>
pygtk mailing list &nbsp; <a href="mailto:pygtk@daa.com.au">pygtk@daa.com.au</a><br>
<a href="http://www.daa.com.au/mailman/listinfo/pygtk" target="_blank">http://www.daa.com.au/mailman/listinfo/pygtk</a><br>
Read the PyGTK FAQ: <a href="http://faq.pygtk.org/" target="_blank">http://faq.pygtk.org/</a><br>
</blockquote></div><br>