Python Script with transparent background?
#1
Hi,

I'm new to the Xbmc community and I just wrote a simple python script with 3 buttons. I currently have an image as my background on my script, but I was wondering if there was a way to have a transparent background on my python script?

I'm using Aeon Nox, so technically, if you guys have seen the "icon panel 1" widget Aeon Nox has, that's more or less what I'm going for, but instead of 4 icons, I'm going for 3 buttons with a transparent screen. I created a custom home menu, "Test", that runs my script. When I hit "ok/enter" on the home menu "(Test") that I created, I get my 3 buttons displayed, I want to be able to see my 3 buttons with a transparent background (whatever background Xbmc currently is). I know the default background is a black color and I have not been able to change it other than by using an image as the background.

Thanks in advanced!
-Ana
Reply
#2
I assume you're using xbmc.gui's WindowXML. Use DialogXML instead. The only difference between Window and Dialog is a Window clears the screen before it's displayed, and a dialog is just drawn on top of whatever is there
Reply
#3
Yes, I was using WindowXML. Switching to that solved my problem. Now, I have a separate problem that ties in to this. I got the transparent background and I'm adding a child window. If you use WindowXML instead of Dialog, you go to your first screen, then your child screen and if you were to hit back, it takes you back to the first screen, which is what I want, but I can't make that happen with WindowDialog. I currently have my windowDialog and it goes to my child screen succesfully and when I hit back, it just exits my whole script. I want to go back to my first window when I hit back on my child screen. Below is a sample code to demonstrate what I'm trying to do. The comments are for using WinodwDialog instead of WindowXML.

import xbmc, xbmcgui
#get actioncodes from keymap.xml
ACTION_PREVIOUS_MENU = 10
ACTION_SELECT_ITEM = 7

class MainClass(xbmcgui.Window): //Change "Window" to "WindowDialog"
def __init__(self):
self.strActionInfo = xbmcgui.ControlLabel(180, 60, 200, 200, '', 'font14', '0xFFBBBBFF')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('Push BACK to quit - A to open another window')
self.strActionInfo = xbmcgui.ControlLabel(240, 250, 200, 200, '', 'font13', '0xFFFFFFFF')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('This is the first window')

def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
if action == ACTION_SELECT_ITEM:
// add "self.close()" to erase the previous screen. If I don't have this, I can still see everything on the first screen
popup = ChildClass()
popup .doModal()
del popup

class ChildClass(xbmcgui.Window):
def __init__(self):
self.addControl(xbmcgui.ControlImage(0,0,800,600, 'background.png'))
self.strActionInfo = xbmcgui.ControlLabel(200, 60, 200, 200, '', 'font14', '0xFFBBFFBB')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('Push BACK to return to the first window')
self.strActionInfo = xbmcgui.ControlLabel(240, 200, 200, 200, '', 'font13', '0xFFFFFF99')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('This is the child window')

def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()

mydisplay = MainClass()
mydisplay .doModal()
del mydisplay


*If this is not possible, is there a way to set my background transparent in WindowXML?
Thanks,
Ana
Reply
#4
On my phone and only got to skim your code, but I think changing .doModal to .show should do what you want
Reply

Logout Mark Read Team Forum Stats Members Help
Python Script with transparent background? 0