Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AppBase(Widget):
- def Launcher(self, launchapp):
- os.system(launchapp)
- def BuildLayout(self):
- layout = GridLayout( rows=4, row_force_default = True, row_default_height = 100, col_force_default = True, col_default_width = 300 )
- with open('config.txt', 'rb') as f:
- reader = csv.reader(f, delimiter="|")
- for row in reader:
- launchbutton = Button( text = row[0], background_normal = 'tile.png', on_press = self.Launcher(row[1]) )
- layout.add_widget(launchbutton)
- return layout
- class MyApp(App):
- def build(self):
- Config.set('graphics', 'width', 1920)
- Config.set('graphics', 'height', 400)
- return AppBase().BuildLayout()
- if __name__ == '__main__':
- MyApp().run()
- launchbutton = Button( text = row[0], background_normal = 'tile.png',
- on_press = self.Launcher(row[1])
- )
- launchbutton = Button( text = row[0], background_normal = 'tile.png',
- on_press = lambda: self.Launcher(row[1])
- )
- launchbutton = Button( text = row[0], background_normal = 'tile.png' )
- launchbutton.bind( on_press = lambda widget: self.Launcher( row[1] ) )
- funcs = []
- for x in xrange(10):
- funcs.append( lambda: x)
- funcs.append( lambda x=x: x)
- funcs.append( lambda inner_x=x: inner_x)
- launchbutton.bind( on_press = lambda widget, appname=row[1]: self.Launcher( appname ) )
- ```for i in list:
- button = ToggleButton(text=i[2],id=i[2],group='pBox')
- button.bind(lambda widget, text=i[2]: on_release=self.switch(PN))
- self.ids.patientBox.add_widget(button)```
Add Comment
Please, Sign In to add comment