Skip to content

Instantly share code, notes, and snippets.

@amalgamatedclyde
Created October 9, 2013 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalgamatedclyde/6902590 to your computer and use it in GitHub Desktop.
Save amalgamatedclyde/6902590 to your computer and use it in GitHub Desktop.
need to update a listview
here is the adapter:
class studentDetailsAdapter(ListAdapter):
def __init__(self, **kwargs):
super(studentDetailsAdapter, self).__init__(**kwargs)
self.args_converter= lambda row_index, rec: {'text': rec,
'size_hint_y': None,
'text_size': (200, 30),
'deselected_color': [1,1,1,1],
'selected_color': [0,0,1,1],
'font_size': 20,
'height': 50}
here is the instance and the listview class:
SDA= studentDetailsAdapter(data= ['testing'], cls= ListItemLabel)
class StudentDetailList(ListView):
global SDA
def __init__(self, **kwargs):
super(StudentDetailList, self).__init__(**kwargs)
self.adapter= SDA
and here is the callback:
def callback(instance):
global SDA
try:
detailsList= StudentDetail(lastname(instance.text), firstname(instance.text))
SDA= studentDetailsAdapter(data= formatlist(detailsList), cls= ListItemLabel)
#details.adapter= SDA
print 'SDA data is', SDA.data
StudentPhoto.source= photoName(detailsList[6])
StudentPhoto.allow_stretch= True
StudentPhoto.scale = 2
#medicalinfo.text= detailsList[7]
#emergencyContact.text= '[b]Emergency Contact: \n[/b]' + '[b]' + detailsList[3] + '[/b]'
except (IndexError, AttributeError):
StudentPhoto.source= '/home/clyde/kids/765-default-avatar.png'
SDA.data= []
the print statement works and pass the label text from the button properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment