Log in

View Full Version : Text Box Content

May 5th, 2009, 02:51 PM
Is there any way to dynamically set the contents of a Text Control? When I dir() one, I see the __setattr__ method, but obviously it is private.

I see nothing in the API docs that could give me a hint.



May 6th, 2009, 06:49 AM
indeed we have not implemented the text control in the current api. we will add it in the future. for now you would have to either use a label or maybe try and put the value into a paramater or an applcation configuration and then use its value as <info>App.Param(VALUE)</info> or <info>App.String(VALUE)</info>.
i think it should work.

May 10th, 2009, 03:10 PM
Example for those who are looking at what idan said with confusion:
import datetime
today = datetime.date.today()
xbmc.executebuiltin('App.SetString(expiry,%s)' % today)
expiry = xbmc.getInfoLabel('App.String(expiry)')
print expiry

Will output something like this in your boxee.log:
16:25:45 T:4608 M:1938624512 NOTICE: Running python script for default application (python)
16:25:45 T:5124 M:1942618112 NOTICE: 2009-05-10
16:25:45 T:5124 M:1942880256 NOTICE:
16:25:45 T:5124 M:1942880256 INFO: Scriptresult: Success

It's then possible to reference the string (expiry in this example) in a skin control label:
<control type="label">

Note, this is kind of unsupported as it's not documented in the API so use it at your own risk. It took me a bit to piece things together between boxee and xbmc to get it to work right for my uses. It's also extremely picky with what you name your string and has some unicode issues. So if one thing doesn't work, try something else. I'm not kidding.

It's a great solution however for storing data temporarily.

May 11th, 2009, 08:30 AM
hey guys,
very good answer. indeed these are not documented cause they are made with the old API we used which has changed since.
this is how you would write it in the current API

import datetime
today = datetime.date.today()

config = mc.GetApp().GetLocalConfig()
config.SetValue( "expiry", str( today ) )

expiry = config.GetValue( "expiry" )
print expiry

May 11th, 2009, 12:04 PM
Awesome, thanks for the followup. I'll have to update my code to use that method now instead of the old convoluted way.

May 13th, 2009, 03:41 PM
One other useful thing I've found out, if you want to debug the settings that get saved to make sure they are definitely getting set. A file gets created in your applications user profile directory for the app you are working on called registry.xml. It has all settings that get saved for an app in it.

May 20th, 2010, 10:44 AM
I'm want to set the text in a textbox using python. Have things improved since these posts? I'm still not sure how to do it.

This is my textbox

<control type="textbox" id="123">

<description>Text Box Item Description</description>
<info>Container(112).ListItem.Property(custom:descriptio n)</info>










<!--autoscroll delay="3000" time="2000" repeat="10000">true</autoscroll-->



Sometimes I would like to replace the text from Container(112).ListItem.Property(custom:descriptio n) with another string using python. Any way to do this?

If it's impossible for the same textbox to show either the Container(112).ListItem.Property(custom:descriptio n) or the other string, I can make another textbox but the problem of giving it some text using python remains.

May 30th, 2010, 10:53 PM
Sorry to bump but I still can't figure out how to set the text of a textbox using python.

June 6th, 2010, 08:27 AM
Sometimes I would like to replace the text from Container(112).ListItem.Property(custom:descriptio n) with another string using python. Any way to do this?
This might help: http://www.cuvedev.net/2010/04/boxee-python-dev/