Until people answered my question, I was working on my own method of doing it. I've only started GUI programming so I don't know all the features of wx so I ended up using the time
module. Anurag's method is probably better since it uses wx functions, but I'll post this here anyways as another way of doing it.
NOTE: This may not always work (I'm having trouble getting it to work with diff interpreters on same OS). So use Anurag's method.
import wx
def vibrate(windowName, distance=15, times=5, speed=0.05, direction='horizontal'):
#Speed is the number of seconds between movements
#If times is odd, it increments so that window ends up in same location
import time
if not times % 2 == 0:
times += 1
location = windowName.GetPositionTuple()
if direction == 'horizontal':
newLoc = (location[0] + distance, location[1])
elif direction == 'vertical':
newLoc = (location[0], location[1] + distance)
for x in range(times):
time.sleep(speed)
windowName.Move(wx.Point(newLoc[0], newLoc[1]))
time.sleep(speed)
windowName.Move(wx.Point(location[0], location[1]))
app = wx.App()
frame = wx.Frame(None, -1, 'Vibrator')
frame.Show()
vibrate(frame)
app.MainLoop()