Advertisement
jevixlugya

Untitled

May 24th, 2023
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. class Homepage(Screen):
  2.     def on_enter(self,*args):
  3.         #def gotoproducts(self):
  4.         try:
  5.         #self.ids.screen_man.current = 'showdata'
  6.         # getting data from real-time database
  7.             self.firebase = firebase.FirebaseApplication('https://lexconnectionsapp-default-rtdb.firebaseio.com/', None)
  8.  
  9.             self.result = self.firebase.get('lexconnectionsapp-default-rtdb/products', None)
  10.             # data i fetched from my database
  11.             self.data = self.result
  12.             products = [item for item in self.data.values()]  # ignore primary key, get the inner dicts
  13.             for product in products:
  14.                 sc = ShowCard(**product)  # same as Showcard(description=product['description'],...)
  15.                 self.ids.prduct_grid.add_widget(sc)
  16.         except Exception as error:
  17.  
  18.             print (str(error))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement