Reputation: 55
here is the main python file...
class MainWindow(Screen): def Get_Trending(self): Twitz = Trending_on_Twitter() Tikz = Trending_on_TikTok() ingrams = Trending_on_Instagram()
Trending = Twitz + Tikz
num = 0
for item in Trending:
button = ToggleButton(text=Trending[num])
self.ids.grid.add_widget(button)
num+=1
here is my kivy file...
BoxLayout:
size_hint_y: .8
orientation:"vertical"
ScrollView:
GridLayout:
id:grid
orientation:"vertical"
size_hint_y: None
height: self.minimum_height
row_default_height:60
cols:1
Label:
id: top_area
text:"Trending On SocialMedia"
height: self.texture_size[1]
BoxLayout:
size_hint_y:.1
orientation:"horizontal"
Button:
text:'Select All'
Button:
text:"next"
everything is working fine when it comes to being able to see my buttons and being able to scroll thru them... i can click them... but i added two buttons... select all and next... i just dont understand how to get the states of these buttons and when i click select all to select all... and when i click next get it to add which buttons were selected to either a list or dictionary or anything really...
thankx in advance
Upvotes: 1
Views: 23
Reputation: 55
num = 0 for item in Trending: mybutton = ToggleButton( text =Trending[num]) mybutton.bind(on_press = self.choices) self.ids.grid.add_widget(mybutton) num+=1
def choices(self,coo):
global Hash_Tags_Selected
#print(coo.text)
#print(type(coo.text))
if coo.text in Hash_Tags_Selected:
try:
Hash_Tags_Selected.remove(coo.text)
except:
pass
else:
try:
Hash_Tags_Selected.append(coo.text)
except:
pass
print(Hash_Tags_Selected)
Upvotes: 1