Problem with ControlList
#1
hello,

There is an error in the 'control list function'

My example code:
Code:
import xbmc, xbmcgui

#get actioncodes from keymap.xml
ACTION_PREVIOUS_MENU = 10

class MyClass(xbmcgui.Window):
  def __init__(self):
    self.strActionInfo = xbmcgui.ControlLabel(250, 80, 200, 200, '', 'font14', '0xFFBBBBFF')
    self.addControl(self.strActionInfo)
    self.strActionInfo.setLabel('Push BACK to quit')
    self.list = xbmcgui.ControlList(200, 150, 300, 400, itemHeight=60)
    self.addControl(self.list)
    self.list.addItem('Item 1')
    self.list.addItem('Item 2')
    self.list.addItem('Item 3')
    self.setFocus(self.list)

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

  def onControl(self, control):
    if control == self.list:
      item = self.list.getSelectedItem()
      self.message('You selected : ' + item.getLabel())

  def message(self, message):
    dialog = xbmcgui.Dialog()
    dialog.ok(" My message title", message)

mydisplay = MyClass()
mydisplay.doModal()
del mydisplay

Error log:

14:22:35 T:1309402176 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: 'itemHeight' is an invalid keyword argument for this function
Traceback (most recent call last):
File "/root/.xbmc/addons/script.home.homecontrol/default.py", line 31, in <module>
mydisplay = MyClass()
File "/root/.xbmc/addons/script.home.homecontrol/default.py", line 11, in __init__
self.list = xbmcgui.ControlList(200, 150, 300, 400, itemHeight=60)
TypeError: 'itemHeight' is an invalid keyword argument for this function
-->End of Python script error report<--
14:22:36 T:1101390896 DEBUG: ------ Window Init (DialogKaiToast.xml) ------
14:22:36 T:1309402176 INFO: Python script stopped

Any Ideas?
Best Regards
Gabor
Reply
#2
Your code is working here!

Did you try setting the height programmatic:
Code:
self.list = xbmcgui.ControlList(200, 150, 300, 400)
self.list.setItemHeight(60)
?

I tested with XBMC Eden.
My GitHub. My Add-ons:
Image
Reply

Logout Mark Read Team Forum Stats Members Help
Problem with ControlList0