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. - #SwagNotifier v1.0 By redhat for activeSwagCodes.
-
import wx, datetime, urllib2
-
#Fetching the swagcode infos
-
swagcode = 1
-
req = urllib2.Request('http://activeswagcodes.com/swagfeed/status.php')
-
handle = urllib2.urlopen(req)
-
raw_info = handle.read()
-
codeinfo = raw_info.split() # codeinfo is an array which has code at 0 value at 1 and expiry at 2
-
if codeinfo[0]=="no":
-
swagcode=0
-
#Window Drawing begins here on:
-
class SwagNotifier(wx.Frame):
-
def __init__(self):
-
wx.Frame.__init__(self, None, -1, 'SwagNotifier 1.0 By ActiveSwagCodes.com', size=(436, 240))
-
try:
-
image_file = 'SwidgetBG.jpg'
-
bmp1 = wx.Image(image_file, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
-
panel = wx.StaticBitmap(self, -1, bmp1, (0, 0))
-
# show some image details in the title
-
except IOError:
-
raise SystemExit
-
# printing text from here on
-
if swagcode==1:
-
str = "Swagcode available!"
-
textcolor = 'blue'
-
else:
-
str = "No Swagcode :("
-
textcolor = 'red'
-
-
text = wx.StaticText(panel, -1, str, (115, 45))
-
font = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD)
-
text.SetBackgroundColour('white')
-
text.SetForegroundColour(textcolor)
-
text.SetFont(font)
-
if swagcode==1:
-
textcolor = 'black'
-
text2 = "SwagCode: %s" % "Go To ActiveSwag"
-
text2_ac = wx.StaticText(panel, -1, text2, (110, 90))
-
text2_ac.SetBackgroundColour('white')
-
text2_ac.SetForegroundColour(textcolor)
-
code_font = wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD)
-
text2_ac.SetFont(code_font)
-
text5 = "Codes.com to get it!"
-
text5_ac = wx.StaticText(panel, -1, text5, (140, 110))
-
text5_ac.SetBackgroundColour('white')
-
text5_ac.SetForegroundColour(textcolor)
-
text5_ac.SetFont(code_font)
-
text3 = "Value: %s" % codeinfo[1]
-
text3_ac = wx.StaticText(panel, -1, text3, (110, 130))
-
text3_ac.SetBackgroundColour('white')
-
text3_ac.SetForegroundColour(textcolor)
-
text3_ac.SetFont(code_font)
-
text4 = "Expire Time: %s" % codeinfo[2]
-
text4_ac = wx.StaticText(panel, -1, text4, (110, 150))
-
text4_ac.SetBackgroundColour('white')
-
text4_ac.SetForegroundColour(textcolor)
-
text4_ac.SetFont(code_font)
-
app = wx.PySimpleApp()
-
frame = SwagNotifier()
-
frame.Show()
-
app.MainLoop()
-
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
0 1523 Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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?
...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |
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,...
|
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: 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...
|
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,...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |