Completely noob question as I am not a programmer but really trying hard to learn Python (Object oriented programming in general).
I am writing a program in python that calls a popup window with some general information with an ok button. If I close the window using the window's close button I have no problems but If I call the same destroy function using the button call, it will not kill the popup. - def destroy(self, widget, data=None):
-
print("Delete event occurred")
-
return False
-
-
self.popup.connect("destroy", self.destroy)
-
-
self.button_pop.connect("clicked", self.destroy)
-
self.popup.conn ect("destroy", self.destroy)
is the gtk window and......
self.button_pop .connect("click ed", self.destroy)
is the button widget in the window. How do I handle this?
z
3 6533
I realize this is a really beginner question. I'm really stuck on this. I can't find an answer. Currently I'm hiding the window with a button call to a function that just runs.....
self.popup.hide ()
I don't think this is the right way to handle the popup window since the window's close is tied to the destroy function. It works when called from the window but not from the button.
z
I would try to destroy the popup window itself:
for example this is code I used in an application to display errors -
self.errorm = gtk.MessageDialog(parent = self.mainwindow, buttons = gtk.BUTTONS_OK, flags = gtk.DIALOG_MODAL, type = gtk.MESSAGE_ERROR, message_format = "Error occured:\n"+message)
-
self.errorm.set_title("Error occured")
-
result = self.errorm.run()
-
self.errorm.destroy()
-
micmast,
Thanks you very much.
I modified this code........ - def destroy(self, widget, data=None):
-
print("Delete event occurred")
-
return False
-
-
self.popup.connect("destroy", self.destroy)
-
-
self.button_pop.connect("clicked", self.destroy)
-
too this....... - def destroy(self, widget, data=None):
-
print("Delete event occurred")
-
self.popup.destroy()
-
-
self.popup.connect("destroy", self.destroy)
-
-
self.button_pop.connect("clicked", self.destroy)
-
and all is well. All I added was self.popup.dest roy(). I swear I tried that! This has been haunting me for a week. I just couldn't get it. Your help is very much appreciated.... ...back to coding.
z
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Samuele Giovanni Tonon |
last post by:
hi,
i'm trying to develop a trivial application which random copy files
from a directory to another one.
i made it using pygtk for the graphical interface, however i find
some problem with progressbar and ListStore:
basically i need to make pulse the progressbar while i'm copying files
and write filenames copied on the ListStore on to the window.
|
by: Johan |
last post by:
Hello!
I'm trying to figure out how to use PYGTK to implement a rudimentary UI:
I want to have an Image as the background, and then be able to put buttons
(eventually icons, but buttons for now)
The PyGTK FAQ (pygtk.org) has some suggestions, but they have failed
to clear up the issue. Using their suggestions as a starting point,
I've arrived at the below. However, it fails in that I can't seem to
|
by: Steve |
last post by:
Hi, I have a nice little script that works well displaying images on
my website. It's a script where if you clik a thumbnail image a pop
up window opens that contains a larger version of the same image. What
I would like to create is a link that can be clicked on to close the
window that contains the larger image. This would make it easier for
the users to close the window. I have posted the script that I use.
Any help would be much...
|
by: MJEASSOC |
last post by:
I need some help with closing a popup window. I'm making an online portfolio,
that has one base page with text and thumbnails. When a user clicks on a thumb,
a new window opens containing a larger image and a caption (each contained on a
separate htm document).
I do this with a function in the header script as follows:
var picpage=" ";
var params=" ";
|
by: kingcrowbar.list |
last post by:
Hello Everyone
I have been playing a little with pyGTK and threading to come up with
simple alert dialog which plays a sound in the background. The need for
threading came when in the first version i made, the gui would freeze
after clicking the close button until pygame finished playing the
sound.
In Windows it was acceptable because it could be ignored easily, but in
| |
by: jubei |
last post by:
I've been trying to write a custom widget for a project, however when i try to run code that uses it i get the following error
> ./nokiagui.py
Traceback (most recent call last):
File "/home/jubei/code/nokia/trunk/nokiagui.py", line 427, in ?
gui = NewGui()
File "/home/jubei/code/nokia/trunk/nokiagui.py", line 193, in __init__
button = pkylib.ComboButton(("foo","bar","baz"))
File "/home/jubei/code/nokia/trunk/pkylib.py",...
|
by: Macbane |
last post by:
Hi,
I have a 'main' form called frmIssues which has a subform control
(named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs.
A control button on the main form opens a pop-up form which allows me
to edit the record in the subform. What I want to happen is for
subform with the new edits to be updated on the main form when I close
the popup. I'm sure this is a very small bit of code in the the 'On
close' event for the popup...
|
by: xrado |
last post by:
when i say window.hide(), window dont hide imidetly
i want to hide it for a few seconds, do something and then show it back
how can i do this?
i have this example:
import pygtk,time
pygtk.require('2.0')
import gtk
|
by: Laharl |
last post by:
I'm working in pyGTK (completely new to it) and I need to display a tic-tac-toe board. It doesn't have to keep track of the game state, just place Xs and Os on click. Unfortunately, I can't get all 9 buttons to show. Currently, I'm trying to use 3 HButtonBoxes of 3 buttons each packed into an VBox. Unfortunately, I get a blank window when I run.
I'm running Python 2.5.1 on Ubuntu Gutsy.
import pygtk
import gtk
class TicTacToe:
def...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |