Add background image to script
#1
Hey there. Im a newbie in scripting for XBMC and python, but Ive managed to put together a script for using XBMC as an alarm clock together with crontab.

Ive run in to one problem tho, which is that I cant change the apperance of the script, all I get is a black background and I kinda want it to look like the skin im using.

For some reason, this wont work:

Code:
self.addControl(xbmcgui.ControlImage(0,0,720, 480, "background.gif"))

Anyone has any idea as to why? Hope this is the right section for this question.
Cheers.
Reply
#2
use windowxml.
Reply
#3
spiff Wrote:use windowxml.

Aha. Any pointers as how to?
Reply
#4
find something using it and do the monkey, e.g. xbmc subtitles. i'm not sure if it is documented in the wiki or not.
Reply
#5
spiff Wrote:find something using it and do the monkey, e.g. xbmc subtitles. i'm not sure if it is documented in the wiki or not.

Ah right. I reckon this means i have to redo all of the actual windows in the script. Had a look at this: http://xbmc.sourceforge.net/python-docs/...#WindowXML

But i have to use a xml-file for the windows? Whats the syntax for those?
Reply
#6
just like any skin xml.
Reply
#7
spiff Wrote:just like any skin xml.

Allright, ive managed to get the xml-file going and put the script together. But now it just displays a black windows. Do I have to add the controls in the same way in the scripts as for ordinary windows? I had look through some other scripts but couldnt find any lines adding any controls, its just self.getControl( xxx ).addLabel("blabla")
Reply
#8
Check out my response in another message.

http://forum.xbmc.org/showpost.php?p=562161&postcount=7
Reply
#9
Hey mate, thanks for the reply. I had a look at it but as far as I can see my code is allright? Guess Im missing something obvious.

default.Py:

Code:
class alarmGUI( xbmcgui.WindowXML):

  def __init__( self, *args, **kwargs ):
      pass

  # define startup labels etc
  def onInit( self ):
        # topic label

      self.getControl(101).setLabel("Push HOME to quit.")

main.xml:

Code:
<window>
  <id>101</id>
  <defaultcontrol always="true">200</defaultcontrol>
  <backgroundcolor>0xFFFFFFFF</backgroundcolor>
  <allowoverlay>yes</allowoverlay>
  <type>window</type>
  <coordinates>
    <system>1</system>
    <posx>0</posx>
    <posy>0</posy>
  </coordinates>
  <controls>
    <control type="group" id="100">
      <description>label group 111+</description>
      <posx>500</posx>
      <posy>500</posy>
      <control type="label" id="101">
        <description>Topic label</description>
        <posx>00</posx>
        <posy>20</posy>
        <visible>true</visible>
        <font>font13</font>
        <textcolor>white</textcolor>
      </control>

etc...

Shorted it bit a down but that would be the relevant lines?

Ah, and I get the reply from XBMC when i run the script: typeerror: non-existent control 101


Cheers
Reply
#10
Allright, I got this working. Just had a few mismatches in my xml-file.
Now I have another problem tho. I would like the script to display in a small window "in front" of the skins, with the same look. Im using Alaska. Right now I only have a black windows covering the entire screen.

main.xml: http://pastebin.org/379304
default.py: http://pastebin.org/379308
Reply
#11
use xbmcgui.WindowXMLDialog
instead of xbmcgui.WindowXML
Reply
#12
ppic Wrote:use xbmcgui.WindowXMLDialog
instead of xbmcgui.WindowXML

As simple as that! Works like a charm, thanks man.
Reply

Logout Mark Read Team Forum Stats Members Help
Add background image to script0