473,511 Members | 16,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wxpython auto refresh every five minutes?

1 New Member
Hello everybody,
i have a script that goes to one website of mine, checks if there is a code available(using urllib2), then, by using wxpython prints the code availability status.

Is there any way i can make my program research for a code every five minutes, then update the text printed on the screen? this program intended to be run in the background.

Also, if it finds a code, if i could make it to ring that would be great.

If it'll help, here is my program's source code.
Expand|Select|Wrap|Line Numbers
  1. #SwagNotifier v1.0 By redhat for activeSwagCodes.
  2. import wx, datetime, urllib2
  3. #Fetching the swagcode infos
  4. swagcode = 1
  5. req = urllib2.Request('http://activeswagcodes.com/swagfeed/status.php')
  6. handle = urllib2.urlopen(req)
  7. raw_info = handle.read()
  8. codeinfo = raw_info.split() # codeinfo is an array which has code at 0 value at 1 and expiry at 2
  9. if codeinfo[0]=="no":
  10.     swagcode=0
  11. #Window Drawing begins here on:
  12. class SwagNotifier(wx.Frame):
  13.     def __init__(self):
  14.         wx.Frame.__init__(self, None, -1, 'SwagNotifier 1.0 By ActiveSwagCodes.com', size=(436, 240))
  15.         try:
  16.             image_file = 'SwidgetBG.jpg'
  17.             bmp1 = wx.Image(image_file, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
  18.             panel = wx.StaticBitmap(self, -1, bmp1, (0, 0))
  19.             # show some image details in the title
  20.         except IOError:
  21.             raise SystemExit
  22.         # printing text from here on
  23.         if swagcode==1:
  24.             str = "Swagcode available!"
  25.             textcolor = 'blue'
  26.         else:
  27.             str = "No Swagcode :("
  28.             textcolor = 'red'
  29.  
  30.         text = wx.StaticText(panel, -1, str, (115, 45)) 
  31.         font = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD)
  32.         text.SetBackgroundColour('white')
  33.         text.SetForegroundColour(textcolor)
  34.         text.SetFont(font)
  35.         if swagcode==1:
  36.             textcolor = 'black'
  37.             text2 = "SwagCode: %s" % "Go To ActiveSwag"
  38.             text2_ac = wx.StaticText(panel, -1, text2, (110, 90))
  39.             text2_ac.SetBackgroundColour('white')
  40.             text2_ac.SetForegroundColour(textcolor)
  41.             code_font = wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD)
  42.             text2_ac.SetFont(code_font)
  43.             text5 = "Codes.com to get it!"
  44.             text5_ac = wx.StaticText(panel, -1, text5, (140, 110))
  45.             text5_ac.SetBackgroundColour('white')
  46.             text5_ac.SetForegroundColour(textcolor)
  47.             text5_ac.SetFont(code_font)
  48.             text3 = "Value: %s" % codeinfo[1]
  49.             text3_ac = wx.StaticText(panel, -1, text3, (110, 130))
  50.             text3_ac.SetBackgroundColour('white')
  51.             text3_ac.SetForegroundColour(textcolor)
  52.             text3_ac.SetFont(code_font)
  53.             text4 = "Expire Time: %s" % codeinfo[2]
  54.             text4_ac = wx.StaticText(panel, -1, text4, (110, 150))
  55.             text4_ac.SetBackgroundColour('white')
  56.             text4_ac.SetForegroundColour(textcolor)
  57.             text4_ac.SetFont(code_font)
  58. app = wx.PySimpleApp()
  59. frame = SwagNotifier()
  60. frame.Show()
  61. app.MainLoop()
  62.  
Thanks for trying to help me, I have some people waiting on me for this project and I'd like to complete it as soon as possible!

-souleiman
Jul 25 '10 #1
0 1523

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

Similar topics

7
40176
by: Willem | last post by:
Can someone tell me how I can get a page(any page) on the Internet to refresh automatically every 5 minutes. I was thinking along the lines of having a HTML file on my C-drive with JavaScript to do...
1
34286
by: Lew | last post by:
Hi all, I'm trying to create a page that has a user-selectable page auto-refresh option (IE 5.5). Essentially, it's a page that contains a checkbox, when the user checks the checkbox, I'd like...
2
6901
by: Rob Evans | last post by:
I have two websites.... I would like to create a frame on a page on website#1, which shows a page from website#2 Furthermore, I would like the frame on website#1 to refresh every 5 minutes or...
2
2438
by: Michelle | last post by:
Hello! I have an .aspx web form in an ASP .NET application that I need to Auto Save every 15 minutes. Could anyone provide examples of client-side Javascript to count down the 15 minutes? ...
7
22674
by: Brian | last post by:
hello, I am looking for a way to auto refresh a web page that I created, but also let the user choose to stop the auto refresh. I can not figure out how to stop the auto refresh. Any help would...
3
3154
by: david | last post by:
I do not have the experience with it. For example, update the data in the ASP form every minute by retrieving data from database. Or do you have other methods? Thank you for any advice and...
4
3211
by: onedbguru | last post by:
DB2Connect Informational tokens are "DB2 v8.1.0.96", "s050811", "U803921", FixPak "10". I am getting txxxxxx.0000 files approximately every 14 minutes that look like: <Trap> <Header> DB2...
2
2846
by: Saray | last post by:
Hi iam using iis 5. My system is not in domain. Also i enabled my integrated windows authentication. Once i enter into my site it prompt for authentication its fine but while i uploading a big file...
3
3569
by: lezzo | last post by:
Hi Guys, I am new to this forum and find very interesting. I need your help in one of the script. I got a MySQL table bid_amount, and i want that if some new data comes in this table and...
2
2903
by: =?Utf-8?B?QW1pciBUb2hpZGk=?= | last post by:
Hi I have a web page that has a TreeView on it. If I DONT'T expand the TreeView nodes, the auto refresh works nicely: my page gets refreshed every minute. As soon as I expand a node on the...
0
7245
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
7356
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
7427
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...
0
7512
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...
0
5671
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,...
1
5069
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...
0
4741
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...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.