Skip to content

Instantly share code, notes, and snippets.

@harmon
Created November 3, 2013 23:53
Show Gist options
  • Save harmon/7296169 to your computer and use it in GitHub Desktop.
Save harmon/7296169 to your computer and use it in GitHub Desktop.
XBMC Sample Script
import xbmc, xbmcgui
#get actioncodes from keymap.xml
ACTION_PREVIOUS_MENU = 10
class MyClass(xbmcgui.Window):
def __init__(self):
self.strActionInfo = xbmcgui.ControlLabel(100, 120, 200, 200, '', 'font13', '0xFFFF00FF')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('Push BACK to quit')
self.button0 = xbmcgui.ControlButton(350, 500, 80, 30, "HELLO")
self.addControl(self.button0)
self.setFocus(self.button0)
def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
def onControl(self, control):
if control == self.button0:
self.message('you pushed the button')
def message(self, message):
dialog = xbmcgui.Dialog()
dialog.ok(" My message title", message)
mydisplay = MyClass(0)
mydisplay.doModal()
del mydisplay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment