473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to click "close window" don't close GTK window?

hi,everyone

I have a GTK window,when click "close window" ,I want to show a verify dialog that whether verify really quit or not.so I used a MesssageDialog for verify quit.But when I clicked the "NO" button on the verify dialog,the GTK window also closed.

The GTK window I make for glade,and I set the signal are "delete_event","close" and "response" all don't doing it.

any help will be appreciate.
Sep 7 '09 #1
2 8143
Markus
6,050 Expert 4TB
Well, I guess you're attaching a callback function to the 'delete-event' singal, correct? Well, depending on the response from the dialog window, your callback should return either TRUE (continue with delete event), or FALSE (cancel delete event). This is what I remember from my brief work with it using PHP-Gtk.
Sep 8 '09 #2
@Markus
thanks Markus,my code is as following:
Expand|Select|Wrap|Line Numbers
  1. def show_verify_dialog(self,str):
  2.     verdialog = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION,buttons=gtk.BUTTONS_YES_NO,message_format=str)
  3.     verd = verdialog.run()
  4.     verdialog.destroy()
  5.     if verd == gtk.RESPONSE_YES:
  6.         return True
  7.     else:
  8.         return False
  9.  
  10.     def gtk_widget_destroy(self,window,event=None):
  11.         mesg = 'Would you like to quit TLait?'
  12.         if show_verify_dialog(self,mesg):
  13.             gtk.main_quit()
  14.         else:
  15.             return
  16.  
Meanwhile,I set the signal is "delete_event",but the problem is as same
Sep 9 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Bruce A. Julseth | last post by:
How do I emulate the web page "Close" Button, i. e. the "X" in the upper right hand corner of each web page? Thank you.... Bruce
2
by: Franklin P Patchey | last post by:
<P><A style="COLOR: rgb(0,0,0); FONT-SIZE: 80%; FONT-FAMILY: 'Comic Sans MS', cursive; TEXT- ALIGN: left" href="javascript:self.close();"><FONT size=4><STRONG>Close this...
2
by: Rob Evans | last post by:
Please excuse my ignorance on this matter.. but.... What exactly is the definition of a "pop-up window" - by that I mean one which will be blocked by software such as the Google Toolbar and...
7
by: Willem van Rumpt | last post by:
Hi all, coming from an unmanaged programming background, I took my time to sort out the IDisposable and finalizer patterns. Just when I thought I had it all conceptually neatly arranged, the...
6
by: Martijn Coppoolse | last post by:
Hello everyone, I've got two little apps which are able to create a window that displays something on the desktop, but are not clickable. Instead, when you click on the window, the item...
1
by: studen771 | last post by:
Thanks in advance to anyone who can help :): I have an .aspx page that creates javascript on the fly within a button click event handler. The script creates a function AND CALLS THAT SAME...
11
by: gg9h0st | last post by:
i saw a code refactorying onload event listener window.onloadListeners=new Array(); window.addOnLoadListener=function(listener) { window.onloadListeners=listener; } why declare the...
5
by: anEchteTrilingue | last post by:
Hi everybody. Thank you for reading my post. I am having trouble getting "this" to work in all versions of IE (it's fine in Firefox, opera, konqueror, etc). What I would like to do is add an...
24
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.