<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> : 'NoneType' object has no attribute 'show'<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('2.0')<br>import gtk <br>import gtk.glade<br>import new_org<br>class mainmenu:<br>
def show_newOrganisation(self,widget):<br> <a href="http://new_org.org">new_org.org</a>()<br> self.gladefile_newOrg = "new_org.glade"<br> self.wTreenewOrg = gtk.glade.XML(self.gladefile_newOrg)<br>
self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget("window_new_org") , None, 0)<br> self.notebook.set_current_page(self.page)<br> <br> def dialogQuit(self,widget):<br> self.dialog_quit = self.wTree.get_widget("dialog_quit")<br>
self.dialog_quit.show()<br> self.response = self.dialog_quit.run()<br> if self.response == 1:# I assigned 1 to quit and -1 to cancel in glade<br> <br> gtk.main_quit()<br> else:<br>
self.dialog_quit.destroy()<br> <br> <br> #To quit the main window<br> def on_Mainwindow_destroy(self):<br> gtk.main_quit()<br><br><br> def __init__(self):<br> #set the glade file<br>
self.gladefile = "gnukhata.glade"<br> self.wTree = gtk.glade.XML(self.gladefile)<br> <br> #get the Main Window and connect the Destroy event<br> self.window = self.wTree.get_widget("MainWindow")<br>
self.window.show()<br> self.window.connect('destroy',gtk.main_quit)<br> self.notebook = self.wTree.get_widget("notebook_main") <br> self.notebook.show() <br> <br>
self.menuitem_quit = self.wTree.get_widget("menuitem_quit")<br> self.menuitem_quit.connect('activate',self.dialogQuit)<br><br> self.menuitem_newOrg = self.wTree.get_widget("menuitem_new_organisation")<br>
self.menuitem_newOrg.connect('activate',self.show_newOrganisation)<br><br> <br>if __name__ == "__main__":<br> mm=mainmenu()<br> 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"><<a href="mailto:albrecht.andi@googlemail.com">albrecht.andi@googlemail.com</a>></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's not gtk.RESPONSE_QUIT response id. When you create the<br>
dialog in Glade you'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>
>>> import gtk<br>
>>> int(gtk.RESPONSE_OK)<br>
-5<br>
>>> 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>
<<a href="mailto:magmaxlistas@gmail.com">magmaxlistas@gmail.com</a>> wrote:<br>
> Hello.<br>
><br>
> I'm not too sure, but I think that you have to compare with<br>
> RESPONSE_CANCEL despite RESPONSE_QUIT. What I'm sure is that you must<br>
> quit the quotes, because it is a var, not a string.<br>
><br>
> If I had had that problem, I had try to set a:<br>
> print gtk.RESPONSE_QUIT, self.response<br>
> between the "run" and the "if" statements, to see what is returning and<br>
> why it is not entering in the condition.<br>
><br>
> Good luck!<br>
><br>
> El Sat, 10 Jan 2009 12:07:18 +0530<br>
> "anusha k" <<a href="mailto:anuhacks@gmail.com">anuhacks@gmail.com</a>> escribió:<br>
><br>
>> hi,<br>
>> I am developing a account application .In that i added a quit dialog<br>
>> with a two stock buttons i.e quit and cancel.but when i triggered the<br>
>> quit button just closes the dialog not the main window .here is my<br>
>> code:<br>
>><br>
>> def dialogQuit(self,widget):<br>
>> self.dialog_quit = self.wTree.get_widget("dialog_quit")<br>
>> self.dialog_quit.show()<br>
>> self.response = self.dialog_quit.run()<br>
>> if self.response == 'gtk.RESPONSE_QUIT':<br>
>> gtk.main_quit()<br>
>> self.dialog_quit.destroy() <<a href="mailto:pygtk@daa.com.au">pygtk@daa.com.au</a>><br>
>><br>
>> how to solve the issue<br>
>><br>
>> Thanks in advance<br>
>><br>
>> Njoy the share of Freedom,<br>
>> Anusha<br>
><br>
><br>
> --<br>
> In a world without walls and fences, who needs Windows and Gates?<br>
</div></div>> _______________________________________________<br>
> pygtk mailing list <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>
><br>
_______________________________________________<br>
pygtk mailing list <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>