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
-
-
class HelloWorld:
-
def click_hide(self, widget, data=None):
-
print "hide"
-
self.window.hide()
-
time.sleep(4)
-
print "show"
-
self.window.show()
-
time.sleep(4)
-
-
def delete_event(self, widget, event, data=None):
-
print "delete event occurred"
-
return False
-
-
def destroy(self, widget, data=None):
-
print "destroy signal occurred"
-
gtk.main_quit()
-
-
def __init__(self):
-
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-
self.window.connect("delete_event", self.delete_event)
-
self.window.connect("destroy", self.destroy)
-
self.button = gtk.Button("hide")
-
self.button.connect("clicked", self.click_hide, None)
-
self.window.add(self.button)
-
self.window.show_all()
-
-
def main(self):
-
gtk.main()
-
-
if __name__ == "__main__":
-
hello = HelloWorld()
-
hello.main()
5 8968 bartonc 6,596
Recognized Expert Expert
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
-
-
class HelloWorld:
-
def click_hide(self, widget, data=None):
-
print "hide"
-
self.window.hide()
-
time.sleep(4)
-
print "show"
-
self.window.show()
-
time.sleep(4)
-
-
def delete_event(self, widget, event, data=None):
-
print "delete event occurred"
-
return False
-
-
def destroy(self, widget, data=None):
-
print "destroy signal occurred"
-
gtk.main_quit()
-
-
def __init__(self):
-
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-
self.window.connect("delete_event", self.delete_event)
-
self.window.connect("destroy", self.destroy)
-
self.button = gtk.Button("hide")
-
self.button.connect("clicked", self.click_hide, None)
-
self.window.add(self.button)
-
self.window.show_all()
-
-
def main(self):
-
gtk.main()
-
-
if __name__ == "__main__":
-
hello = HelloWorld()
-
hello.main()
I looks to me like you have not subclassed properly; In the other Gui Too Kits that I have used it's always something like this: -
class HelloWorld(GTK.TopLevelWindow):
-
# call the superclass __init__() IFF you override it
-
# the superclass has all of the gui commands including main()
i dont think this is the problem...
i added the print lines to observe what is going on
it prints "hide" and waits for 4 sec, then prints "show" and waits for 4 sec
only after that window hides in shows again in less then sec
bartonc 6,596
Recognized Expert Expert
i dont think this is the problem...
i added the print lines to observe what is going on
it prints "hide" and waits for 4 sec, then prints "show" and waits for 4 sec
only after that window hides in shows again in less then sec
Ok. That explains a lot. This sounds like gtk is running the interpeter that is getting the print command in a separte thread from the one running your GUI app. Look and see if gtk has a timer class that generates events. The thing is that once you have a gui app, the best practice is to use only gui events for timing puposes.
gtk.gdk.flush() ..do the trick :)
bartonc 6,596
Recognized Expert Expert
gtk.gdk.flush() ..do the trick :)
Thanks for keeping us up to date. This will, no doubt, help someone else down the line.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ahk |
last post by:
As subject. TIA.
|
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: Nick Atkins |
last post by:
Hi all,
I am writing an application using pyGTK that has several pop-up dialogs
that show and hide in succession. I would like to prevent the user
from closing the dialog and if possible I'd like to use a "title
bar-less" window with a normal border so the X is not even available to
click. Is this possible? I have tried using
window.set_decorated(FALSE) but this also removes the border making the
window look quite strange.
|
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: sapo |
last post by:
Hi all, i ve started learning pygtk with glade, i m just making some
test stuff. but i got some problems with simple things.
I designed 2 windows on glade, then exported it and loaded in the
python script, the second window is hidden by default, then i wrote a
function to show it up, ok it shows, them i wrote another function to
hide it.. ok it hides...
But in the second time i show the window.. the window appear EMPTY,
with just the...
| |
by: Tim N. van der Leeuw |
last post by:
I tried to create a windows executable of a pygtk program. My first
attempt worked, kinda, except that no themes were applied and no
readable fonts were found by pango; so all letters where just empty
squares. But the program worked.
I looked up some docs, found the following recipe on the PyGTK Wiki
site:
http://starship.python.net/crew/theller/moin.cgi/Py2exeAndPyGTK
I followed those instructions to convert my setup.py file;...
|
by: Peter TB Brett |
last post by:
Hi folks,
I'm currently trying to work out how to detect when a PyGTK window
receives the focus from the window manager -- I assume that it must
receive some kind of X event, but I can't work out which signal it
generates. Searching around the subject on the web doesn't seem to pull up
anything useful.
I tried the "focus" signal, but that doesn't work the way I'd like it
to. For example, the following code only prints the message...
|
by: manatlan |
last post by:
I was a fan of "SimpleGladeApp/tepache way" to build a pygtk app.
I've build a new efficient/dynamic way to build a pygtk app ...
Here is an example :
=================================================
class Fen(GladeApp):
"""
Window win
.title="Hello"
@delete_event
|
by: Michael Palmer |
last post by:
On Sep 16, 12:30 pm, binaryjesus <coolman.gu...@gmail.comwrote:
I haven't tried it myself, but I came across a blog post the other day
that describes a way of building windows installers for pyGTK
applications at
http://unpythonic.blogspot.com/2007/07/pygtk-py2exe-and-inno-setup-for-single.html
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |