Hey everyone,
Below is my code for Python. The reason I'm using times is so that the program runs and then goes off a little bit in the future. So what I do is set the time about a minute later than the current time. Then I run the program and when it is time, the boxes come up. Sometimes they will go the current location fine, but other times, usually when the computer is doing something.. like if I am loading a video on youtube, etc...the boxes will freeze at random points before they get to the set location. What is going on here!
Also, the reason I have the time.sleep(0.5) in the while loop is because otherwise the program hogs up the computer's resources. Sorry for the sloppiness in the while loop.. just trying to test the code! Thanks everyone! -
import wx
-
import wx.lib
-
import time
-
import webbrowser
-
-
class Window ( wx.MiniFrame ):
-
-
def __init__ ( self ):
-
-
mini = wx.MiniFrame(None, -1, 'A Small Frame', pos=(wx.DisplaySize()[0]-250,wx.DisplaySize()[1]), size=(250,80), style=wx.STAY_ON_TOP)
-
mini.SetBackgroundColour("#506970")
-
mini5 = wx.MiniFrame(mini, -1, 'Background Part', pos=(wx.DisplaySize()[0]-250,wx.DisplaySize()[1]+15), size=(250,65), style=wx.STAY_ON_TOP)
-
mini5.SetBackgroundColour("green")
-
-
-
stepZZZ2 = wx.StaticText(mini, -1, "X" , pos=(250-14-3, 0), size = (14,14) )
-
stepZZZ2.SetForegroundColour("#F0F0F0")
-
stepZZZ2.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD, False, u'Tahoma'))
-
stepZZZ2.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
-
stepZZZ2.Bind(wx.EVT_LEFT_DOWN, lambda e, s=self: self.closeOut(mini))
-
-
-
str1 = "Random text"
-
step5a = wx.StaticText(mini, -1, str1 , wx.Point(5, 0))
-
step5a.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma'))
-
step5a.SetForegroundColour("#F0F0F0")
-
-
-
stepZZZ = wx.StaticText(mini, -1, "X" , pos=(250-14-3, 0), size = (14,14) )
-
stepZZZ.SetForegroundColour("#F0F0F0")
-
stepZZZ.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD, False, u'Tahoma'))
-
stepZZZ.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
-
stepZZZ.Bind(wx.EVT_LEFT_DOWN, lambda e, s=self: self.closeOut(mini))
-
-
-
strALOT = "Random link"
-
step5z = wx.StaticText(mini5, -1, strALOT, pos = (0,0), size=(250,65), style=wx.ALIGN_CENTER)
-
step5z.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD, False, u'Tahoma'))
-
step5z.SetForegroundColour("black")
-
step5z.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
-
step5z.Wrap(230)
-
step5z.Bind(wx.EVT_LEFT_DOWN, lambda e, s=self: s.loadLink())
-
step5z.SetPosition( ( (250-step5z.GetSize()[0])/2.0, (65-step5z.GetSize()[1])/2.0 ))
-
-
-
mini.Show(True)
-
mini5.Show(True)
-
currX = wx.DisplaySize()[0]-250
-
currY = wx.DisplaySize()[1]
-
currX2 = wx.DisplaySize()[0]-250
-
currY2 = wx.DisplaySize()[1]+15
-
for count in range(110):
-
step5a.Update()
-
step5z.Update()
-
stepZZZ.Update()
-
time.sleep(1/110.0)
-
mini.Move( (currX, currY-(count+1)) )
-
mini5.Move( (currX2, currY2-(count+1)) )
-
-
-
mini.Show ( True )
-
mini5.Show ( True )
-
def closeOut(self,mini2):
-
mini2.Destroy()
-
def loadLink(self):
-
webbrowser.open("http://www.google.com/")
-
-
-
-
application = wx.PySimpleApp()
-
timelater=time.mktime((2008,12,28,9,2,30,362,5,-1))
-
count=0
-
donebefore="no"
-
doit="no"
-
while(True):
-
count=count+1
-
timenow=time.mktime(time.gmtime())
-
if(timenow > timelater and donebefore=="no"):
-
doit="yes"
-
donebefore="yes"
-
else:
-
doit="no"
-
-
if(doit=="yes"):
-
Window()
-
time.sleep(.5)
-
application.MainLoop()
-
-
0 1703 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Anand |
last post by:
I am calling a python script from LabVIEW. This is achieved by making
a dll call to python22.dll. It works perfectly well for most of my
code. I now want to throwup dialog boxes from python. It...
|
by: wang xiaoyu |
last post by:
Hello:
i want use activex in wxpython program,but when i use MakeActiveXClass
an exception occurs.
this is my source code dealing the DICOM ocx.I must note that in this
program "hwtxcontrol" is...
|
by: SeeBelow |
last post by:
Do many people think that wxPython should replace Tkinter? Is this
likely to happen?
I ask because I have just started learning Tkinter, and I wonder if I
should abandon it in favor of...
|
by: Grant Edwards |
last post by:
Can anybody recommend a good book on wxPython? Are there any
books on wxPython?
I've been trying to learn wxPython and/or wax for a few weeks,
and I'm just not getting it.
wxWindows seems...
|
by: BJörn Lindqvist |
last post by:
See: http://www.wxpython.org/quotes.php. especially:
"wxPython is the best and most mature cross-platform GUI toolkit,
given a number of constraints. The only reason wxPython isn't the
standard...
|
by: Peter Maas |
last post by:
Recently I replaced Win2k with Linux on my desktop computer. Using mostly
multi-platform software I thought this would be easy. It was not as
easy as expected getting wxPython to work. There seemed...
|
by: Robin Dunn |
last post by:
Announcing
----------
The 2.6.3.0 release of wxPython is now available for download at
http://wxpython.org/download.php. There have been many enhancements
and fixes implemented in this...
|
by: Robin Dunn |
last post by:
Announcing
----------
The 2.6.3.0 release of wxPython is now available for download at
http://wxpython.org/download.php. There have been many enhancements
and fixes implemented in this...
|
by: Brian Blais |
last post by:
Hello,
I have a wxPython program that I would like to give to a friend of mine who has a
Mac. Is there a resource out there that can tell me what steps I need to follow to
do this? Under...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
header("Location:".$urlback);
Is this the right layout the...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
| |