XBMC Community Forum  

Go Back   XBMC Community Forum > Development > Plugin/Script (Python) Development

Plugin/Script (Python) Development Developers forum for XBMC Python Plugins/Scripts. Scripters/coders only!
Not for posting feature requests, bugs, or end-user support requests!

Reply
 
Thread Tools Search this Thread Display Modes
Old 2004-06-10, 08:36   #1
Alexpoet
Skilled Python Coder
 
Join Date: Jun 2004
Location: Oklahoma City, OK
Posts: 172
Alexpoet is on a distinguished road
Default

hey,
i'm having trouble with a looping gui program. it's not updating the screen and i believe the problem is that i've ported a tkinter python gui over to the xbmcui.

for the most part, things are working. actually, for anyone else building tkinter versions of xbox scripts to test on the pc, i highly recommend using the canvas object for everything. you can use the same coordinates and widths for items, and the create_image function is very similar in structure to the xbmcgui controlimage.

ehh. way off track. my point is, where i used self.after() for all my delayed calls in the tkinter script, there is no self.after() in xbmcgui (apparently). anyone have any suggested workarounds that would keep the script running while delaying a function call? time.sleep(), of course, delays the whole script.

also, if there's not an easy way to script in a self.after(), does anyone know a function call to force an xbmcgui update?

thanks for any help.
__________________
For scripts, script development tools, and documentation, visit my website:
http://www.maskedfox.com/xbmc/
Alexpoet is offline   Reply With Quote
Old 2004-06-15, 17:04   #2
Alexpoet
Skilled Python Coder
 
Join Date: Jun 2004
Location: Oklahoma City, OK
Posts: 172
Alexpoet is on a distinguished road
Default

okay, i think i've got this resolved (i'm having problems making the gui itself draw my images, so i can't particularly test this, but it seems like a useful pair of functions so i'm sharing it...in case it does work (shrug).

you have to import "thread" and "time" which are both python built-ins.

Quote:
def after(self, wait, func): * # passed time in msecs, function to call.
* *# run the function in a new thread, so it won't hang main script
* *thread.start_new_thread(self.delay, (wait, func))

def delay(self, wait, func):
* *time.sleep(wait * .001) * *# convert msecs into secs and delay this thread
* *func() * * * * * * * * * * * * *# call the function passed as a parameter
and example function call would be:
Quote:
* *self.after(5000, self.close)
to delay the self.close() function long enough for all my other loops to end (which keeps xbmc from hanging on close).
__________________
For scripts, script development tools, and documentation, visit my website:
http://www.maskedfox.com/xbmc/
Alexpoet is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Time-Zone (and daylight savings-time) option when using default time-server Simba XBMC Feature Suggestions 25 2006-10-01 10:31
Newb needs advice on image looping Spoetzl Plugin/Script (Python) Help and Support 1 2006-08-05 18:35
Looping weather radar script now available Alexpoet Plugin/Script (Python) Development 2 2004-11-28 03:36
mpg playback looping to the beginning midway thru evanfrank XBMC for Xbox Specific Support 0 2004-03-09 09:36
Sleep time stekam XBMC Feature Suggestions 0 1970-01-01 02:00


All times are GMT +2. The time now is 21:09.


Protected by Akismet, We recommend WordPress blogs
Copyright © 2008, XBMC Project