473,769 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wxtimer...I need to close a dialog after a particular time...

17 New Member
Hello all,
Actually i need to close a dialog automatically after 5-6 seconds.
For it what should i do,please help me.I am using wxTimer
[code]
self.MB = wx.Dialog(self,-1,"hello",pos =(-1,-1),size=(200,10 0),style=wx.NO_ 3D)
self.MB.Show(Tr ue)
self.timer = wx.Timer(5,self .Step(self))
self.timer.Star t()


def Step:
if self.timer.IsRu nning():
print ""
else:
self.MB.Close(T rue)
[code]
Is this code is not correct or what?
Please help me.
Mar 12 '08 #1
1 1689
jlm699
314 Contributor
Expand|Select|Wrap|Line Numbers
  1. self.MB = wx.Dialog(self,-1,"hello",pos=(-1,-1),size=(200,100),style=wx.NO_3D)
  2. self.MB.Show(True)
  3. self.timer = wx.Timer(5,self.Step(self))
  4. self.timer.Start()
  5.  
  6.  
  7. def Step:
  8. if self.timer.IsRunning():
  9. print ""
  10. else:
  11. self.MB.Close(True)
  12.  
Is this code is not correct or what?
Please help me.
No this code is not correct.
Expand|Select|Wrap|Line Numbers
  1. self.MB = wx.Dialog(self,-1,"hello",pos=(-1,-1),size=(200,100),style=wx.NO_3D)
  2. self.MB.Show(True)
  3. # wrong initialization of timer
  4. self.timer = wx.Timer(self.Step())
  5. ## self.timer = wx.Timer(5,self.Step(self))
  6. # Start needs the time in milliseconds
  7. self.timer.Start(5000)
  8. ## self.timer.Start()
  9.  
  10. # Function declaration needs () argument list
  11. def Step(self):
  12.     if self.timer.IsRunning():
  13.         print ""
  14.     else:
  15.         self.MB.Close(True)
  16.  
Also, I hope that your formatting is correct and you simply lost it because you didn't use code tags...
Mar 12 '08 #2

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

Similar topics

0
463
by: Austin | last post by:
I wrote a GUI program on windows. (python & wxPython) One function is to refresh the data from the COM Object continously. In the beginning, I used the thread.start_new_thread(xxx,()) But no matter how i try, it will cause the win32com error. After that, i use the wx.Timer to do the refresh function. It works fine, but i find one problem. I think timer should be independant, just like thread, but wxTimer doesn't. 1. Does python have...
3
20612
by: Jonan | last post by:
Hi, I use JavaScript I have tree windows. Jonan1.html has this code erref1=window.open("Jonan2.html", "mypage",null); This opens Jonan2.html and it has this code erref=window.showModalDialog("Dialogo.html", null); This opens Dialogo.html How can I do to close Jonan2.html and Dialogo.html from Jonan1.html How can I get the Dialogo.html reference from Jonan1.html.
6
8539
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This all works fine. If the user selects "Open" or "Cancel", the window closes, which is the desired behavior. If they select "Save", the location dialog shows up, they save the file and the window remains open. I've tried a number of things to get...
4
1858
by: nsr93 | last post by:
I am not sure if this was the proper group to post this, but here is my question: I am a Java consultant. I have new client I am working for to make a web based application similar to an ecommerce site. We aren't selling anything but we have a notion of a cart where you add schedule items. You can perform actions such as add/edit/remove schedule items to a schedule. This is an over simplifcation but you get the idea. I am not a...
19
4108
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
34
7326
by: Mark Kamoski | last post by:
Hi-- Please help. I need a code sample for bubble sort. Thank you. --Mark
22
130403
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the document and closes it with the following code: <body onload="window.print(); window.close();"> This works correctly (or at least the way I expect it to work under MS Internet Explorer, but it cuases Netscape to "crash"
4
2759
by: georges the man | last post by:
hey guys, i ve been posting for the last week trying to understand some stuff about c and reading but unfortunaly i couldnt do this. i have to write the following code. this will be the last time i ask for an entire code or u can give me the outine of what to do and i ll do it by myself. the description is the following: the program will read a text file that contains historical price of a stock. The program will allow users to query...
7
2919
by: Sin Jeong-hun | last post by:
I have a dialog form which pops up from the main window using the ShowDialog() method. this dialog has no or button, and it has quite a lot of controls on it. Now, I want to close this dialog form when the user presses the escape key, but that's only when no control on the form is responsible for the escape key. For example, it has a ComboBox control, and a user can press the escape key just to close the drop down list that is being...
0
9579
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, 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...
0
10208
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, 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...
0
9857
tracyyun
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...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
isladogs
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...
0
5294
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...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
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...

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.