Thread Rating:
  • 0 Vote(s) - 0 Average
Python Dev Tool: XBMC Emulator scripts
hey all,
i'm in the process of developing a pair of dummy scripts (xbmc and xbmcgui) that will use tkinter to draw xbmc python scripts on your computer.

i haven't seen any discussion of such scripts before (i've seen references to "stubbed out" scripts, but i'm pretty sure these go above and beyond those). so i don't know if everyone's been doing this for themselves, but it basically just simulates the xbmcgui calls on the pc.

note that the emulator isn't a perfect replica of the libraries used on the xbox, so most scripts will require some slight modification to work with it. but i'm designing the system so that any necessary lines to make the emulator work, won't in any way interfere with xbox operation. so you can write one script, and it'll work on either platform.

this first post is (now that i've edited it), just the announcement of the purpose. in my first reply, i'll include links to the most current version of the scripts, as well as any notes about the state of development and current known issues.

thank you all for your interest, and any feedback you provide.


note: once i've got the emulator to a reasonable degree of finished, i'm planning on starting work on some additional widgets. if you have particular widget requests, feel free to mention them, but that will be an entirely new kind of project for me, so i can't promise much.
For scripts, script development tools, and documentation, visit my website:
major development: while the emulator is still in the early stages of development, it's made a pretty major breakthrough today. with the help of bitplane over the last week, i've got pretty much every function at least stubbed out, and most of xbmcgui working faithfully. i finally managed to add controls simulating the xbox controller today, and now consider the emulator a highly useful tool to any xbmc python developer.

it can also be used for trying out (or test-driving) third-party scripts, by running them on your pc to see what they're supposed to do on your xbox. obviously, this only works to the extent that the emulator emulates the necessary functions, but for many things it will be useful.

included with the emulator is a couple of kinds of documentation (a short manual, as well as a much shorter readme), and a gif image. be sure to place the gif image in the python lib folder, along with the emulator scripts, to make the emulator run properly.

again, my thanks to bitplane for his help with this project.

also, as i'm still very much working on improving it, any feedback or testing you're willing to do will contribute to the quality of the final product. so even though the emulator isn't finish, i'd be grateful to anyone willing to download and work with it.

of course, i ask that you not hate me for releasing code that won't yet do everything it's supposed to. but i do welcome advice, criticism, or useful feedback of any sort. i'm not a particularly good programmer, so if you see something i've done glaringly wrong, please point it out. note, though, that i'll probably bug you with stupid questions until i figure out how to fix it. :-)

current version updated july 14, 2004
the current version can be found here.

at the moment, there are still virtually no comments in the scripts (except those added by bitplane). i do mean to fix that--i've just been too busy developing up until now.

drop the necessary files in the "lib" subfolder of your python installation on your pc. do not put them on your xbox. you'd probably really regret that (although all you'd have to do to fix it would be deleting them again).

again, any comments are welcome.

For scripts, script development tools, and documentation, visit my website:
w00t! :kickass:
ever since i broke my xbox and have to use my parents
i've got to run up and down stairs all the time when testing, and i can only code when they're not using it (like when they're in bed).
since i'm a lazy mofo i won't be writing any more python until i can do it in my own time and from the comfort of my arse! i was waiting for python support in mediaportal but this would work just as well.

keep up the good work Smile
sounds very cool. i actually threw together an and so i could test out xbmc scripts that i was writing on the pc. though all they did was print output to the stdout.
it sounds as if these would be very useful.
good to see some interest!

i was away for a family reunion over the holiday weekend, so there's been no development since last thursday, but i am back to working on it.

currently i'm getting lots of lockups with no error output, so it's hard to track down. so i've got to throw a bunch of debug output in and see what i can see, which will take some time.

i'll keep you posted as i put up new versions, though. please feel free to post here any errors you're getting, particularly functions/classes missing from the emulator. the big one i know is missing from xbmcgui is controllist (and fadelabel doesn't throw an error, but it also doesn't show anything atm). xmbc itself is still pretty much empty, except for the keyboard.

anyway, as i said, i'm back to work on it, and hope to have something helpful for you soon.
For scripts, script development tools, and documentation, visit my website:
i've been playing with your emulator scripts in work, i can get away with it since python looks geeky enough to be real work.

working! (well, no real gui)

missing functions... irc client, tvguide, simplekml, xbmcmail:

hard coded e:/q: ... needs settings files, can't download them here

and all these come back with the same error... hangman, internet test, itunes, xmovieguide:

file "c:\python23\lib\", line 242, in
self.tkobj = photoimage(file = filename)
file "c:\python23\lib\lib-tk\", line 3176, in
image.(self, 'photo', name, cnf, master, **kw)
file "c:\python23\lib\lib-tk\", line 3117, in
raise runtimeerror, 'too early to create image'
runtimeerror: too early to create image
thanks for that list. that is very helpful.

i intend to get into the emulator scripts and add a whole boatload of comments, as soon as the initial development wanes. that will probably help.

another thing i came up cannot be entirely an emulator. i tried and tried, but i had to add a few lines that will run when on the pc, that won't run when on the xbox. all the "too early to create image" errors can be fixed by explicitly calling an init function on the xbmcgui.window, but you only do that when emulating.

i won't include the code here, but i'll write up a readme (i meant to already) to include with the dev tools to explain how to write xbox scripts that can work cleanly with the emulator.

unfortunately, the emulator is just a dev tool--i can't write it to automatically work with everyone else's xbox scripts, but if devs want to use it when writing their own scripts, it only takes a few extra lines.

that's my intent, anyway. maybe once i've gotten it cleaned up and commented, and i release it to the public, some of the really clever guys can read through it and show me how to fix those things.

For scripts, script development tools, and documentation, visit my website:
i've slightly rewritten the first post in this thread, stating the purpose of the emulator, and significantly rewritten the second one. i'm going to maintain that as my main link post, and just edit it whenever i release an update. so keep an eye on that post for new releases.

that said, i will point out that i just released a new version (still way early in the development) that includes a readme and a manual, so you can at least see how it's supposed to work.

For scripts, script development tools, and documentation, visit my website:

the emulator's a lot closer to useful, as of today! (i stated that a little bit more confidently in the release post up top....) but i've now got controller emulation working, and a lot more of the necessary functions stubbed out.

be sure to read the readme (or, if you're the curious sort, the 6-page manual), because you can't always just download a script from the downloads page and play it on the emulator. but it's getting closer....
For scripts, script development tools, and documentation, visit my website:
:o woow this sounds great i will test this emulator.
i read your pdf doc and it was wery nice written.

i think this will help me alot

Livingroom: MacMini Mid summer 2010 4Gb RAM HDMI to Pioneer PDP-434 Plasma 1080i
Kitchen: one xbox 1.1 executer 2.3 chip 120 GB in HD 720p mode
Bedroom: Computer Intel Quad 9400, 8 GB RAM, NVIDIA GTX260, Vista Ultimate 64, Ubuntu 10.10
hi there !

great tool ! :bowdown:
i am trying to create my own script and run in to problems with the emulator.
if i try to use the script supplied with the xmbc stuff and alter it with the two lines mentioned in the manual i get this:

traceback (most recent call last):
 file "c:\program files\python 23\_xbox\\scripts\", line 90, in ?
   meteo = window()
 file "c:\program files\python 23\_xbox\\scripts\", line 19, in
   self.straction = xbmcgui.controllabel(100, 100, 200, 200, '', 'font13')
typeerror: () takes exactly 8 arguments (7 given)

it seems the xbmcgui needs another argument  !
can someone shed some light here ?
i want to use this as a base for my own experiment ( showing graphical traffic jams in holland..)

also where can i find info about the classes, methods etc. that can be used ?

and finally, what ide's are people using for this?
is idle really the one or am i missing something?
there seems to be a plugin for eclipse but that also doesn't seem to be finished...

any help would be grately appreciated !

i'll look into it. looks like i've got an optional argument emulated as a required argument (or something like that). if so, it should be simple to fix that problem.

i'm really interested in the script you're trying to write. sounds very cool. super helpful (well...for people who drive in holland, anyway :-)

concerning ides, komodo by activestate is a very good one. i'm using activestates's python plugin for visual studio .net but that, of course, is a pretty expensive solution. komodo at least has a free trial.
For scripts, script development tools, and documentation, visit my website:
thanx for the speedy response,
i work for an it company and as such can get my hands on any ms and ibm software i want .. :nuts: .. so visual studio is not an problem.
although i don't really use it i must say.
regarding the traffic stuff..
here is the link: anwb traffic
basically it is a html page with randomly generated images in it. the idea is to search for #map (since they are using image maps) in the html, download that image. that is the main image. and then place the other links , which are links to other areas on the side or something like that.
thats why i wanted to use something like

okay, my guess was right. where xbmcgui allowed you to have optional arguments, i had them required. i went ahead and put in default values (of "none", as those label items don't actually do anything right now anyway), which should make it possible to test your script.

another known issue with the emulator (and a fairly crippling one) has to do with png images. currently even with pil installed, python can't read in interlaced png images, apparently. and apparently all the png images i use are interlaced. go figure.

if any of you are getting the error "couldn't read image data in [filename]", this is why. it's a known issue...and surprisingly hard to fix.

i've got an ugly fix in place--if the emulator sees you trying to load up a png image, it replaces the filename with a ".gif" ending. which means you'll need to have a gif copy of your image for testing on the pc (on the xbox, it'll still load pngs, which can probably do more than the gifs could anyway).

like i say, it's ugly. but it's the only thing that works right now. you'll have to make duplicated of all your image files, and keep them on the pc.

umm...okay, i've just made these changes. give me a couple of hours to test them a little bit, and then i'll put them up on my website. i'll let you know.

oh! also, i'm planning on renaming the file. right now it's called "xpy_devtools.rar". i'm going to keep that name for a package containing the emulator, my transitions library, and scriptionary (and any other dev tools i develop over time). meanwhile, i'm going to change the name of the just emulator package to simply "". hope this causes less confusion.

For scripts, script development tools, and documentation, visit my website:
okay, new version of the emulator is up on my website. please visit my website to get the download, as the link on the downloads page is probably still pointing to the old filename.

(link to my webpage is in my sig.)

please let me know what you think of the changes. descriptions of problems are always helpful in future development!
For scripts, script development tools, and documentation, visit my website:

Logout Mark Read Team Forum Stats Members Help
Python Dev Tool: XBMC Emulator scripts00