Boxee python dev
// april 10th, 2010 // Boxee, Cuvedev, Python
Tags: Boxee, development, dialog, error, errors, import, onload, python, setlabel, textboxBoxee may be “the best way to enjoy entertainment from the Internet and computer on your TV” (according tor their website), the developers documentation isn’t all that great. Not everything is well-documented and the (python) API doesn’t always do what’s expected, which makes developing own plugins not that easy.
It isn’t also always possible to find the right solution with Google. Maybe because not all that much people are developing plugins for Boxee (or the don’t care to share) or because Google doesn’t index it well.
So I decided to share the things I found. Let’s hope google indexes them well and I’m able to help some fellow developers.
Textbox + SetLabel:
If you have a textbox, it is not possible to change the label via python in an easy way.
mc.GetActiveWindow().GetLabel([id]).SetLabel('text')
and
mc.GetActiveWindow().GetControl([id]).SetLabel('text')
don’t work on a Textbox, and
GetTextbox([id])
doesn’t exist.
Setting the label can be done this way:
xbmc.executebuiltin('Control.SetLabel([id],[text])')
and you’ll have to replace every comma (,) with $COMMA
Onload-tag with a dialog
I’ve experienced some troubles with the onload-tag in windows with type=”dialog”. If you have a normal window, and load a dialog-window in a onclick method with this code, the onload of the dialog won’t work until you close the dialog:
<![CDATA[ mc.ActivateWindow(14001) ]]>The way to solve this is to dump the python code to load the dialog and just do this:
ActivateWindow(14001)
Python import gives errors:
It took me a while to figure out, but this error:
18:54:51 T:2963869696 M:410439680 NOTICE: -->Python Interpreter Initialized<-- 18:54:51 T:2963869696 M:410439680 NOTICE: Traceback (most recent call last): 18:54:51 T:2963869696 M:410439680 NOTICE: File "", line 2, in ? 18:54:51 T:2963869696 M:410439680 NOTICE: ImportError 18:54:51 T:2963869696 M:410439680 NOTICE: : 18:54:51 T:2963869696 M:410439680 NOTICE: No module named xxxxxxx 18:54:51 T:2963869696 M:410439680 ERROR: Scriptresult: Error
Was caused by a bad window-id. Boxee window-id’s should be between 14000 and 14099
Close a window with type=”dialog”:
If you have opened a window with type=”dialog”, it isn’t possible to close the window with this code:
CloseWindow(14001)
Instead you have to do this:
Dialog.Close(14001)
You can also add the “force” option (True/False), adding this option will skip all animations.


Very well! Thank you for this and thanks for your interest in helping other developers achieve their solutions. I agree about the documentation, its kind of dry and no examples other than command syntax. Ive found most my solutions by seeing other applications source code through the userdata/apps directory.
I also try to found solutions by looking through others source code. Sometimes it’s so hard to find a solution. That’s why I share it. It makes it easier for people with the same problems.
It’s a pity that those other people don’t always share.
But ah well, I’m glad I could help you
Hi,
I had to google about the same problem with the textbox for dev in XBMC. I don’t know if this method exists in the boxee framework but in XBMC you can use setText(“test”) for setting some text to the textbox-component. (http://xbmc.sourceforge.net/python-docs/xbmcgui.html#ControlTextBox).
Thanks for you share. Bye