Created
September 26, 2013 15:27
-
-
Save amalgamatedclyde/6715793 to your computer and use it in GitHub Desktop.
on_selection_change binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here is the button that does the job i want on_selection_change to do: | |
in kv | |
Button: | |
id: mybutton_id | |
detailBox: detailBox | |
size_hint: (None, .1) | |
text: 'press' | |
on_release: detailBox.adapter= ListAdapter(data=StudentDetail(lastname(mylist.adapter.selection[0].text), firstname(mylist.adapter.selection[0].text)), cls=ListItemLabel) | |
on_release: photo.source= photoName(StudentDetail(lastname(mylist.adapter.selection[0].text), firstname(mylist.adapter.selection[0].text))[6]) | |
this is my app: | |
class StudentlistApp(App): | |
def __init__(self, **kwargs): | |
super(StudentlistApp, self).__init__(**kwargs) | |
self.list_item_args_converter = \ | |
lambda row_index, rec: {'text': rec, | |
'size_hint_y': None, 'deselected_color': [.1,0,.3,1], | |
'height': 25} | |
self.studentAdapter= ListAdapter(data=StudentList(), | |
allow_empty_selection= False, cls= ListItemButton) | |
self.detailboxAdapter= ListAdapter(data=StudentDetail('0', '0'), cls=ListItemLabel) | |
self.detailboxAdapter.on_selection_change= ListAdapter(data=StudentDetail('Barcelona', 'Bette'), cls=ListItemLabel) | |
this is the list i want updated: | |
BoxLayout: | |
#size_hint: (.3, .75) | |
DetailView: | |
id: detailBox | |
adapter: app.detailboxAdapter | |
#id:d_adapter | |
and this is the list with the selection change that i want to bind to: | |
BoxLayout: | |
detailBox: detailBox | |
size_hint: (.4, 1) | |
pos_hint: {'right': 1} | |
#pos_hint: {'top': -1} | |
MyList: | |
id: mylist | |
adapter: app.studentAdapter | |
Write Preview Comments are parsed with GitHub Flavored Markdown | |
Add Comment | |
© 2013 GitHub Inc. All rights reserved. | |
The GitHub Blog Support Contact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment