I'm terrible at python and need your help with two questions
#1
Hey so I have a working script that I'm trying to add two features too. As it turns out I happen to not be picking up python very quick. This is a one-off effort and I'd just like it done. Also I think what I'm looking for would be very simple for someone experienced to answer, versus hours of head scratching for me.

So the prelude to my question is what my script is for. I have a home automation door bell hooked up to notify me when someone rings the doorbell. I then have an ip Camera take some photos of who it is.

When someone rings the bell, this script I wrote gets invoked. The script simply enough grabs the image from the camera and displays it on the screen.

I'm looking for two pieces of functionality:

1) I need to somehow loop sleep every second and essentially refresh the image on the screen. The image location gets refreshed on its own independent of this script. So I just need to keep loading that image and redrawing it on screen to get an animation or "video" from the camera.

2) I somehow need to exit the script after a timeout. As in I want this script to exit on it's own with no user interaction.

So all in all, including the existing functionality the script should behave is follows.

1) Invoke script and display image when someone rings bell (done)
2) Every second refresh that image
3) After 10 seconds exit the script, taking me back to whatever was on screen before, such as video, homescreen, etc.

Could someone please help me, it'd be much appreciated. Thanks.


Code:
# Import the XBMC/XBMCGUI modules.
import xbmc, xbmcgui

class MyScript(xbmcgui.Window):

    def __init__(self):
        
         self.addControl(xbmcgui.ControlImage(100, 0, 1080, 720, "special://masterprofile/media/bell.jpg"))

My_Window = MyScript()
My_Window.doModal()
del My_Window
Reply


Messages In This Thread
I'm terrible at python and need your help with two questions - by doobiest - 2013-02-18, 11:22
Logout Mark Read Team Forum Stats Members Help
I'm terrible at python and need your help with two questions0