XBMC Scripts/Python/Lists and Filters
#1
OK, so I'm just starting to try my hand at Python and I'm stumbling on an issue within a script.

Contained within the script are two lists assigned to list controls.

What I'd like to accomplish is something as follows:

List1 and its listcontrol1.getselectedvalue will provide the filter criteria for List2 this value gets assigned to a variable in onaction code which inexplicably gets blown away...Yet, Ironically I can set the text to a label with that same variable...

After List2 is filtered listcontrol2 will then be assigned the filtered list2.. By assigned I mean the usual additem loop.

I'm sorry/embarrased that I do not have my code with me at the moment to post it within this message.

But I was hoping that some skilled python coder in their infinite wisdom could provide me a simpleton example as to how to accomplish this.

I'm familiar with the list filter and list comprehension code but for some reason I cannot get it to work in this particular script.

Any code references, help, or otherwise will be appreciated..Needling, ridicule, ballbusting, and/or profane insults will also be accepted.Big Grin

I'm at my wits end on this, I'd pull out my hair but it's gone already...Heheh
Thanks,

Oh and if this post doesn't belong here please relocate and/or incinerate it....

FC
Reply
#2
use the listcontrol1.getselectedvalue as in the loop to fill list2.

eg:
Code:
filter = listcontrol1.getselectedvalue

for k,v in list2:
  if k == filter:
    add to listcontrol..

very simplified but that should do the trick.

Ofcourse you need to adept the for loop to suit your needs .. but maybe you get how I mean..
Reply
#3
Cool

Blittan,

Thanks for the response.. You confirmed that I was indeed doing it correctly. I was just attempting it in the wrong place.. As with the other languages I've learned in the past sometimes it takes running into the same wall many times and getting bloodied and bruised before learning the complexities and nuances of the environment your in... I was nearly convinced that it wasn't going to happen soon enough though..

I'm on my way though Big Grin...

As elementary as my question was it was enough frustrate me to near insanity. Sometimes I think having learned to program other languages can be a burden, you know what you want to do and by all means it looks correct but it's not familiar enough to be 100%..

Anyway, thanks again hopefully I'll be able to finish this up and get it out there for use...

FC
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC Scripts/Python/Lists and Filters0