Guest User

Untitled

a guest
Feb 17th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. class AppBase(Widget):
  2.  
  3. def Launcher(self, launchapp):
  4. os.system(launchapp)
  5.  
  6. def BuildLayout(self):
  7. layout = GridLayout( rows=4, row_force_default = True, row_default_height = 100, col_force_default = True, col_default_width = 300 )
  8. with open('config.txt', 'rb') as f:
  9. reader = csv.reader(f, delimiter="|")
  10. for row in reader:
  11. launchbutton = Button( text = row[0], background_normal = 'tile.png', on_press = self.Launcher(row[1]) )
  12. layout.add_widget(launchbutton)
  13. return layout
  14.  
  15.  
  16. class MyApp(App):
  17.  
  18. def build(self):
  19. Config.set('graphics', 'width', 1920)
  20. Config.set('graphics', 'height', 400)
  21. return AppBase().BuildLayout()
  22.  
  23. if __name__ == '__main__':
  24. MyApp().run()
  25.  
  26. launchbutton = Button( text = row[0], background_normal = 'tile.png',
  27. on_press = self.Launcher(row[1])
  28. )
  29.  
  30. launchbutton = Button( text = row[0], background_normal = 'tile.png',
  31. on_press = lambda: self.Launcher(row[1])
  32. )
  33.  
  34. launchbutton = Button( text = row[0], background_normal = 'tile.png' )
  35. launchbutton.bind( on_press = lambda widget: self.Launcher( row[1] ) )
  36.  
  37. funcs = []
  38. for x in xrange(10):
  39. funcs.append( lambda: x)
  40.  
  41. funcs.append( lambda x=x: x)
  42.  
  43. funcs.append( lambda inner_x=x: inner_x)
  44.  
  45. launchbutton.bind( on_press = lambda widget, appname=row[1]: self.Launcher( appname ) )
  46.  
  47. ```for i in list:
  48. button = ToggleButton(text=i[2],id=i[2],group='pBox')
  49. button.bind(lambda widget, text=i[2]: on_release=self.switch(PN))
  50. self.ids.patientBox.add_widget(button)```
Add Comment
Please, Sign In to add comment