def generate_GUI(menus): app_gui = TabbedPanel() app_gui.clear_tabs() app_gui.orientation = "vertical" app_gui.do_default_tab = False app_gui.tab_width = 150 for menu_key, sub_menu in menus.items(): main_menu = TabbedPanelHeader(text=menu_key) scroll_pane = ScrollView() scroll_pane.scroll_type = ['bars', 'content'] scroll_pane.bar_pos_y = 'left' scroll_pane.bar_width = 6 scroll_pane.do_scroll_y = True scroll_pane.do_scroll_x = False scroll_pane.scroll_y = 1 menu_grid = GridLayout(cols=1, spacing=2, size_hint_y=None) menu_grid.orientation = "vertical" menu_grid.padding = 10 menu_grid.row_default_height = 1 menu_height = 0 print(">>>" + menu_key) for sub_menu_key, items in sub_menu.items(): menu_grid.add_widget( Label(text=" " + sub_menu_key, size_hint=(None, None), font_size=14, halign="left", valign="middle")) print("\t" + sub_menu_key) for option in items: if "Name" in option: print("\t\t" + option["Name"]) btn = Button(text=option["Name"], size_hint=(0.1, None), background_color=(0.2, 1, 1, 0.8)) btn.bind(on_press=lambda x: webbrowser.open(option["URL"])) else: print("\t\t" + "<EMPTY>") btn = Button(text="<EMPTY>", size_hint=(0.1, None), background_color=(0.2, 1, 1, 0.8)) btn.bind(on_press=lambda x: webbrowser.open(option["URL"])) btn.width = 250 btn.height = 50 menu_grid.add_widget(btn) menu_height += 80 menu_height += 51 menu_grid.height = menu_height scroll_pane.add_widget(menu_grid) main_menu.content = scroll_pane main_menu.orientation = "vertical" # Adding headers to main layout app_gui.add_widget(main_menu) return app_gui
def build(self): base_layout = BaseLayout() step_base = ScrollView(size_hint=(1, 1), do_scroll_y=True, do_scroll_x=True) step_base.bar_width = 20 step_base.scroll_type = ['bars'] paint_widget = MyPaintWidget() step_base.add_widget(paint_widget) return step_base
def build(self): layout = GridLayout(cols=5, spacing=15, row_force_default=True, row_default_height=75, size_hint_y=None) # Make sure the height is such that there is something to scroll. label_layout = FloatLayout() layout.bind(minimum_height=layout.setter('height')) label_layout.add_widget(Label(text='Actual Image', size_hint=(.2,.1), pos_hint={'x':.04, 'center_y': .45})) label_layout.add_widget(Label(text='Network Image', size_hint=(.2,.1), pos_hint={'x':.31, 'center_y': .45})) label_layout.add_widget(Label(text='Network Portrayal', size_hint=(.2,.1), pos_hint={'x':.52, 'center_y': .45})) label_layout.add_widget(Label(text='Actual Portrayal', size_hint=(.2,.1), pos_hint={'x':.70, 'center_y': .45})) label_layout.add_widget(Label(text='Correct?', size_hint=(.2,.1), pos_hint={'x':.83, 'center_y': .45})) for j in range(157): #First column: Actual image layout.add_widget(Image(source='face1.png')) #Second column: Network's image reconstruction layout.add_widget(Image(source='face1.png')) #Third column: Network Representation layout.add_widget(Label(text='mad', size_hint=(.5,.5))) #Fourth column: Actual representation layout.add_widget(Label(text='happy', size_hint=(.5,.5))) #Fifth column: correct/incorrect layout.add_widget(Label(text='1', size_hint=(.5,.5))) root = ScrollView(size_hint=(1, .4)) root.add_widget(layout) root.bar_width = 10 label_layout.add_widget(root) return label_layout
def fill_menu_with_data(): # Necesary to flush old data airtable_content.clear_tabs() # Layout metadata to specify dimension and style airtable_content.orientation = "vertical" airtable_content.do_default_tab = False # Necesary to disable Default Tab that TabbedPanel generate automatically airtable_content.background_color = (0, 0, 1, .5) #50% translucent airtable_content.tab_width = 150 # Trigger airtable connection and data retrieval # tab_headers and tab_menus have all data needed to fill airtable_content fetch_airtable_data() # Creation of each Tab and their respective items for header in tab_headers: tab = TabbedPanelHeader(text=header) # Scrollview required to adequatly contain items without window or objec distortion # Effectively scroll through the menu effortlessly scroll = ScrollView() scroll.bar_margin = 10 scroll.size_hint = (1, 1) # Needed to allow scrollview to fit the window regarless od size scroll.scroll_type = ['bars', 'content'] # allow scrolling via the bar or by draging content scroll.bar_pos_y = 'left' scroll.bar_width = 20 scroll.bar_color = (5, 10, 15, 0.8) scroll.bar_inactive_color = (5, 20, 15, 0.8) scroll.do_scroll_y = True # Needed for vertical scrolling scroll.do_scroll_x = False scroll.scroll_y = 1 # Scrolling speed # Adding item specifically fitted for the current tab scroll.add_widget(format_airtable_data(header)) tab.content = scroll # adding scrollview with fitted items as content of the tab tab.content.orientation = "vertical" airtable_content.add_widget(tab) # adding the entirity of a tab page to the TabbedPanel
def __init__(self, **kwargs): super(ROACH, self).__init__(kwargs=kwargs) self.config_manager = LoadSaveConfig(os.path.dirname(os.path.realpath(__file__)) + '/roach_configurations') big_one = BoxLayout(orientation='vertical') self.reg_array = {} self.reg_cont = 0 self.bram_array = {} self.bram_cont = 0 #self.snapshot_array = {} #self.snapshot_cont = 0 self.prog_dev = False self.bof_path = '' self.sources = [] self.function = [] # reg layout roach_connection_info = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) roach_register = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,40)) ip_label = Label(text='IP :') port_label = Label(text='Port :') self.ip = TextInput(multiline=False) self.port = TextInput(multiline=False, Text='7417') roach_connection_info.add_widget(ip_label) roach_connection_info.add_widget(self.ip) roach_connection_info.add_widget(port_label) roach_connection_info.add_widget(self.port) clear_button = Button(text='clear', size_hint=(0.33,1)) save_button = Button(text='save', size_hint=(0.33,1)) clear_button.bind(on_press=self.clear_button) save_button.bind(on_press=self.button_save_all) self.program_button = ToggleButton(text='program', size_hint=(0.33,1)) buttons_layout = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) buttons_layout.add_widget(clear_button) buttons_layout.add_widget(save_button) buttons_layout.add_widget(self.program_button) new_reg_label = Label(text='Initial Values', size_hint=(0.6,None), height=40) new_reg = Button(text='new reg', size_hint=(0.4,None), height=40) new_reg.bind(on_press=self.add_registers) roach_register.add_widget(new_reg_label) roach_register.add_widget(new_reg) ##### Regiter container self.reg_container = GridLayout(cols=1, spacing=0, size_hint_y=None)#row_default_height=30) self.reg_container.bind(minimum_height=self.reg_container.setter('height')) scroll_root = ScrollView(size_hint=(1,1), size=(1, 125)) scroll_root.add_widget(self.reg_container) #### free_running_label_layout = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) add_free_running_label = Label(text="Free Running", size_hint=(0.45,1)) free_running_label_layout.add_widget(add_free_running_label) free_running = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) add_free_running_bram = Button(text = 'New BRAM', size_hint=(0.30,1)) add_free_running_reg = Button(text = 'New Reg', size_hint=(0.25,1)) add_free_running_snapshot = Button(text = 'SnapShot', size_hint=(0.25,1)) add_free_running_bram.bind(on_press=self.add_free_running) add_free_running_reg.bind(on_press=self.add_register_free_running) add_free_running_snapshot.bind(on_press=self.add_snapshot_free_running) free_running.add_widget(add_free_running_bram) free_running.add_widget(add_free_running_reg) free_running.add_widget(add_free_running_snapshot) #### free run container self.free_run_container = GridLayout(cols=1, spacing = 3,size_hint=(1,None), size=(1,30)) self.free_run_container.bind(minimum_height=self.free_run_container.setter('height')) scroll_root_free_run = ScrollView(size_hint=(1,1), size=(1,195), scroll_type=['bars']) scroll_root_free_run.add_widget(self.free_run_container) scroll_root_free_run.bar_width = 10 #### size_ = 30 name_config = Button(text='Name',size_hint=(0.25,None), height=size_) self.name_config_input = TextInput(size_hint=(0.5,None), height=size_) buton_bof_file = Button(text='Add bof',size_hint=(0.25,None), height=size_) print os.path.dirname(os.path.realpath(__file__)) + '/roach_configurations' name_config.bind(on_press=self.open_look_directory) fc = BofFileChooserIconView(self.set_bof_path) self.file_choose_popup = Popup(title='Choose Bof', auto_dismiss=False, content=fc,\ size_hint=(None, None), size=(400,400)) fc.set_popup(self.file_choose_popup) buton_bof_file.bind(on_press=self.file_choose_popup.open) name = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) name.add_widget(name_config) name.add_widget(self.name_config_input) name.add_widget(buton_bof_file) ## store or plot big_one.add_widget(name) big_one.add_widget(roach_connection_info) big_one.add_widget(buttons_layout) big_one.add_widget(roach_register) big_one.add_widget(scroll_root) big_one.add_widget(free_running_label_layout) big_one.add_widget(free_running) big_one.add_widget(scroll_root_free_run) padding_layout = BoxLayout() #big_one.add_widget(padding_layout) self.add_widget(big_one) self.do_extraction = None
def setMenu(self, menuNum, *largs): self.menu = menuNum print("menu is now: " + str(menuNum)) # Undo the previous menu self.clear_widgets() if self.menu == 0: # Add the start button self.startLayout = AnchorLayout(anchor_x='center', anchor_y='center') self.startLayout.size = Window.size self.startLayout.center = Window.center startButton = Button(text="Start") startButton.size_hint = 0.5, 0.2 startButton.font_size = 35 buttonEvent = partial(self.setMenu, 1) startButton.bind(on_press=buttonEvent) self.startLayout.add_widget(startButton) # Add the settings button self.settingsLayout = AnchorLayout(anchor_x='left', anchor_y='bottom') self.settingsLayout.size = Window.size self.settingsLayout.center = Window.center settingsButton = Button(text="") settingsButton.size_hint = None, None settingsButton.size = 50, 50 settingsButton.font_size = 15 buttonEvent = partial(self.setMenu, 3) settingsButton.bind(on_press=buttonEvent) self.settingsLayout.add_widget(settingsButton) # Add the layouts to the main widget self.add_widget(self.startLayout) self.add_widget(self.settingsLayout) elif self.menu == 1: # Add the back button self.backLayout = AnchorLayout(anchor_x='center', anchor_y='top') self.backLayout.size_hint = None, None self.backLayout.size = Window.size[0], Window.size[1] * 0.95 self.backLayout.center = Window.center btn = Button(text="back", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) btn.bind(on_press=partial(self.setMenu, 0)) self.backLayout.add_widget(btn) # Set up the centered drinks list self.mainLayout = AnchorLayout(anchor_x='center', anchor_y='bottom') self.mainLayout.size_hint = None, None self.mainLayout.size = Window.size[0], Window.size[1] self.mainLayout.center = Window.center layout = GridLayout(cols=1, spacing=30, size_hint_y=None) layout.size_hint_x = 0.8 layout.bind(minimum_height=layout.setter('height')) # Add all the different drinks for i in range(len(drinksList)): if drinksList[i]["canMake"]: btn = Button(text=str(drinksList[i]["name"])) btn.font_size = 25 btn.size_hint_y = None btn.height = 60 btn.bind(on_press=partial(self.setDrink, drinksList[i])) layout.add_widget(btn) # Add some spacing at the end lbl = Label(text="", height=60) layout.add_widget(lbl) # Set up scrolling of the main list scrolling = ScrollView(size_hint=(None, None), size=(Window.width, Window.height)) scrolling.add_widget(layout) scrolling.size_hint = None, None scrolling.size = self.mainLayout.size[ 0] * 0.75, self.mainLayout.size[1] * 0.83 scrolling.center = self.mainLayout.center scrolling.bar_width = 30 scrolling.bar_margin = 0 scrolling.bar_inactive_color = [.7, .7, .7, .9] scrolling.scroll_type = ["bars"] layout.center = scrolling.center self.mainLayout.add_widget(scrolling) # Add the various sections to the root widget self.add_widget(self.mainLayout) self.add_widget(self.backLayout) elif self.menu == 2: # Add the back button self.backLayout = AnchorLayout(anchor_x='center', anchor_y='top') self.backLayout.size_hint = None, None self.backLayout.size = Window.size[0], Window.size[1] * 0.95 self.backLayout.center = Window.center btn = Button(text="back", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) buttonEvent = partial(self.setMenu, 1) btn.bind(on_press=buttonEvent) self.backLayout.add_widget(btn) # Add the make button self.makeLayout = AnchorLayout(anchor_x='center', anchor_y='bottom') self.makeLayout.size_hint = None, None self.makeLayout.size = Window.size[0], Window.size[1] * 0.95 self.makeLayout.center = Window.center btn = Button(id="btnmake", text="make", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) buttonEvent = partial(self.makeDrink) btn.bind(on_press=buttonEvent) self.makeLayout.add_widget(btn) # Make the central layout self.drinkLayout = AnchorLayout(anchor_x='center', anchor_y='bottom') self.drinkLayout.size_hint = None, None self.drinkLayout.size = Window.size[0], Window.size[1] self.drinkLayout.center = Window.center for ing in self.currentDrink["ingredients"]: if ing["name"] not in self.settings["liquidsAvail"]: print("substituting " + ing["name"] + " for " + getLiquid(ing["name"])["subs"]) ing["oldName"] = ing["name"] ing["name"] = getLiquid(ing["name"])["subs"] # Add the drop down boxes to the info self.drinkInfo = GridLayout(cols=4, spacing=15, size_hint=(None, None)) for index, ing in enumerate(self.currentDrink["ingredients"]): if "oldName" in ing.keys(): spinner = Label(text=ing["oldName"] + "\n(" + ing["name"] + ")", size_hint=(None, None), size=(190, 50), font_size=fs) else: spinner = Label(text=ing["name"], size_hint=(None, None), size=(190, 50), font_size=fs) spinner.ind = index self.drinkInfo.add_widget(spinner) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeDrink, index, -25)) self.drinkInfo.add_widget(btn) lbl = Label(id="lbl" + str(index), text=str(ing["ml"]) + " ml", size_hint=(None, None), height=50, width=80, font_size=fs) self.drinkInfo.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeDrink, index, 25)) self.drinkInfo.add_widget(btn) # Set up the scrolling list of ingredients self.scrollingDrinks = ScrollView(size_hint=(None, None), size=(Window.width, Window.height)) self.scrollingDrinks.size_hint = None, None self.scrollingDrinks.size = self.drinkLayout.size[ 0] * 0.85, self.drinkLayout.size[1] * 0.85 self.scrollingDrinks.center = self.drinkLayout.center self.scrollingDrinks.add_widget(self.drinkInfo) self.drinkLayout.add_widget(self.scrollingDrinks) # Add the various sections to the root widget self.add_widget(self.backLayout) self.add_widget(self.drinkLayout) self.add_widget(self.makeLayout) self.checkDrink() elif self.menu == 3: # Add the back button self.backLayout = AnchorLayout(anchor_x='center', anchor_y='top') self.backLayout.size_hint = None, None self.backLayout.size = Window.size[0], Window.size[1] * 0.95 self.backLayout.center = Window.center btn = Button(text="back", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) buttonEvent = partial(self.setMenu, 0) btn.bind(on_press=buttonEvent) self.backLayout.add_widget(btn) # Create the keypad self.keypadWrapper = AnchorLayout(anchor_x='center', anchor_y='center') self.keypadWrapper.size_hint = None, None self.keypadWrapper.size = Window.size[0], Window.size[1] self.keypadWrapper.center = Window.center self.keypadLayout = GridLayout(cols=3) self.keypadLayout.size_hint = None, None self.keypadLayout.size = Window.size[0] * 0.5, Window.size[1] * 0.5 self.keypadLayout.center = Window.center for i in range(9): btn = Button(size_hint=(None, None), size=(80, 80), font_size=fs) buttonEvent = partial(self.enterCode, i + 1) btn.bind(on_press=buttonEvent) self.keypadLayout.add_widget(btn) self.keypadWrapper.add_widget(self.keypadLayout) # Add the various sections to the root widget self.add_widget(self.backLayout) self.add_widget(self.keypadWrapper) elif self.menu == 4: # Add the back button self.backLayout = AnchorLayout(anchor_x='center', anchor_y='top') self.backLayout.size_hint = None, None self.backLayout.size = Window.size[0], Window.size[1] * 0.95 self.backLayout.center = Window.center btn = Button(text="back", size_hint=(None, None), size=(Window.width / 1.1, Window.height / 10.0), font_size=fs) buttonEvent = partial(self.setMenu, 0) btn.bind(on_press=buttonEvent) self.backLayout.add_widget(btn) self.controlLayout = AnchorLayout(anchor_x='center', anchor_y='bottom') self.controlLayout.size_hint = None, None self.controlLayout.size = Window.size[0] * 0.9, Window.size[ 1] * 0.80 self.controlLayout.center = (Window.center[0], Window.center[1] - 50) # Set up the wrapper grid self.wrapperGrid = GridLayout(cols=1, spacing=15, size_hint=(None, None)) self.wrapperGrid.size = (self.controlLayout.size[0] * 0.99, self.controlLayout.size[1] * 0.99) self.wrapperGrid.center = self.controlLayout.center # Set up the liquid list grid self.liquidGrid = GridLayout(cols=2, spacing=15, size_hint=(None, None)) self.liquidGrid.size = (self.wrapperGrid.size[0] * 0.9, self.wrapperGrid.size[1] * 0.5) self.liquidGrid.center = (self.wrapperGrid.center[0], self.wrapperGrid.center[1]) for index, liq in enumerate(self.settings["liquidsAvail"]): spinner = Spinner(text=liq, id="sd" + str(index), values=liquidNameList, size_hint=(None, None), size=(200, 60), font_size=fs, pos_hint=(None, None)) spinner.bind(text=self.change_avail_drink) self.liquidGrid.add_widget(spinner) # Add the settings layout self.controlGrid = GridLayout(cols=4, spacing=15, size_hint=(None, None)) self.controlGrid.size = (self.wrapperGrid.size[0] * 0.9, self.wrapperGrid.size[1] * 0.30) self.controlGrid.center = self.wrapperGrid.center # Add a value setting lbl = Label(text="maxBooze", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxBooze", -25)) self.controlGrid.add_widget(btn) lbl = Label(id="maxBooze", text=str(self.settings["maxBooze"]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxBooze", 25)) self.controlGrid.add_widget(btn) # Add a value setting lbl = Label(text="maxVol", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxVol", -25)) self.controlGrid.add_widget(btn) lbl = Label(id="maxVol", text=str(self.settings["maxVol"]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxVol", 25)) self.controlGrid.add_widget(btn) # Add a value setting lbl = Label(text="maxChange", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxChange", -25)) self.controlGrid.add_widget(btn) lbl = Label(id="maxChange", text=str(self.settings["maxChange"]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "maxChange", 25)) self.controlGrid.add_widget(btn) # Add buttons to change active solenoid setting lbl = Label(text="selectedDrink", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind( on_press=partial(self.changeSetting, "selectedSetting", -1)) self.controlGrid.add_widget(btn) lbl = Label(id="selectedSetting", text=str(self.settings["selectedSetting"]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind( on_press=partial(self.changeSetting, "selectedSetting", 1)) self.controlGrid.add_widget(btn) # Add a value setting lbl = Label(text="milliPer25", size_hint=(None, None), height=50, width=180, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="-", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "milliPer25", -5, self.settings["selectedSetting"])) self.controlGrid.add_widget(btn) lbl = Label(id="milliPer25", text=str(self.settings["milliPer25"][ self.settings["selectedSetting"] - 1]), size_hint=(None, None), height=50, width=80, font_size=fs) self.controlGrid.add_widget(lbl) btn = Button(text="+", size_hint=(None, None), height=50, width=50, font_size=fs) btn.bind(on_press=partial(self.changeSetting, "milliPer25", 5)) self.controlGrid.add_widget(btn) # Add the various sections to the root widget self.add_widget(self.backLayout) self.wrapperGrid.add_widget(self.liquidGrid) self.wrapperGrid.add_widget(self.controlGrid) self.controlLayout.add_widget(self.wrapperGrid) self.add_widget(self.controlLayout)
def __init__(self, *args, **kwargs): global s_y, n, yh, yg, sa, btnlist, lbllist btnlist = [] lbllist = [] super().__init__(*args) sel = ScrollView() self.add_widget(sel) dat = os.listdir('.') data = [] for item in range(len(dat)): if dat[item].endswith(".pdf"): data.append(dat[item]) n = len(data) sa = FloatLayout() s_y = 1.02 if n < 11: pass else: s_y = s_y + (n - 10) / 11 sa.size_hint = (1, s_y) with self.canvas: Color(0, 0.5, 1, 1) Rectangle(pos=(0, 0.95 * h), size=(w, h * 0.05)) self.bt2 = Button(size_hint=(0.1, 0.05), pos_hint={ 'x': 0.9, 'y': 0.95 }, background_normal="Icon/add.png") self.add_widget(self.bt2) self.bt2.bind(on_press=self.change) sel.do_scroll_x: False sel.do_scroll_y: True sel.scroll_y = 1 sel.bar_width = 5 sel.size = Window.size sel.add_widget(sa) yh = 0.2 for i in range(n): if i % 2 == 0: z = 0 else: z = 0.5 lb = Label(color=(0, 0, 0, 1), text=data[i], size_hint=(0.5, 0.05 / s_y), pos_hint={ 'x': z, 'y': (s_y - yh) / s_y }) sa.add_widget(lb) if i % 2 != 0: yh = yh + 0.17 lbllist.append(lb) yg = 0.16 for i in range(n): if i % 2 == 0: z = 0.15 else: z = 0.65 btn = Button(background_normal="Icon/pdf.png", size_hint=(0.2, 0.1 / s_y), pos_hint={ 'x': z, 'y': (s_y - yg) / s_y }) sa.add_widget(btn) if i % 2 != 0: yg = yg + 0.17 btnlist.append(btn)