Re: [pygtk] hide on delete_event()

2008-12-09 Thread Peyman
Hey Neil

I tried your method, but it didn't work. I suspected it wouldn't  
seeing as how it's essntially the same thing I was doing. I wonder  
what could be causing my problem

Thanks anyways


Peyman Askari

On 9 Dec 2008, at 03:34, Neil Dugan wrote:

 Peyman wrote:
 Hello
 I am new to this mailing list. Originally I was posting to the  
 glade  mailing list
 My question is a simple one, I want my window to hide when I close  
 it  (by clicking 'x'). I have browsed the web and the answer  
 appears to be
 def on_window_delete_event(widget,data,wtree):
  print If you can read this, then everything should work fine
  widget.hide()
  return gtk.TRUE
 But when I do this very exact thing it still gets destroyed. And  
 later  when I call the drawingArea widget (inside the window) it  
 claims there  is no such widget.
 Anyone else run into this problem?
 Thank You
 Peyman Askari

 I use this, to hide my dialog

 class MyDialog :
 ---cut---
  def __init__(self)
self.window = gtk.Dialog(..)
self.window.connect('delete_event', self.hide)
 ---cut---
  def hide(self, dialog=None, event=None) :
self.window.hide()
return True# stop any event handling here
 ---cut---
  def show(self, callback = None):
self.window.show()
 ---cut---

 Regards Neil

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] hide on delete_event()

2008-12-09 Thread Paul Malherbe




Hi

The following code seems work OK.

import gtk
import time

def
on_window_delete_event(widget, data):
 print "hide", widget
 widget.hide()
 while gtk.events_pending():

gtk.main_iteration()
 time.sleep(10)
 print "show", widget
 widget.show()
 return True

win = gtk.Dialog()
win.connect("delete_event", on_window_delete_event)
win.set_size_request(300,200)
win.show_all()
gtk.main()












Regards 

Paul
Malherbe

+27
(0) 21 6711866
+27
(0) 82 9005260 



Peyman wrote:

  Hey Neil

I tried your method, but it didn't work. I suspected it wouldn't  
seeing as how it's essntially the same thing I was doing. I wonder  
what could be causing my problem

Thanks anyways


Peyman Askari

On 9 Dec 2008, at 03:34, Neil Dugan wrote:

  
  
Peyman wrote:


  Hello
I am new to this mailing list. Originally I was posting to the  
glade  mailing list
My question is a simple one, I want my window to hide when I close  
it  (by clicking 'x'). I have browsed the web and the answer  
appears to be
def on_window_delete_event(widget,data,wtree):
		print "If you can read this, then everything should work fine"
		widget.hide()
		return gtk.TRUE
But when I do this very exact thing it still gets destroyed. And  
later  when I call the drawingArea widget (inside the window) it  
claims there  is no such widget.
Anyone else run into this problem?
Thank You
Peyman Askari
  

I use this, to hide my dialog

class MyDialog :
---cut---
 def __init__(self)
   self.window = gtk.Dialog(..)
   self.window.connect('delete_event', self.hide)
---cut---
 def hide(self, dialog=None, event=None) :
   self.window.hide()
   return True		# stop any event handling here
---cut---
 def show(self, callback = None):
   self.window.show()
---cut---

Regards Neil

  
  
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

  



___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/