def add_picture(self, picture): scatter = Scatter() scatter.size = picture.size scatter.center = Window.center scatter.rotation = random.randint(-30, 30) scatter.add_widget(picture) self.root.add_widget(scatter)
def build(self): b = BoxLayout(orientation='vertical') f = FloatLayout() s = Scatter() t = TextInput(font_size=150, size_hint_y=None, height=200, text='default') l = Label(text="default", font_size=150) t.bind(text=l.setter('text')) f.add_widget(s) s.add_widget(l) b.add_widget(t) b.add_widget(f) button1 = Button(text="Send", background_color=(0.572, 0.45, 0.65, 1), font_size=80, size_hint_y=None, height=100) b.add_widget(button1) return b
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Hello", font_size=150) f.add_widget(s) s.add_widget(l) return f
def _add_expanded_image (self, wid): for child in self._expansion_cont.children: if type (child) == FloatLayout: self._expansion_cont.remove_widget (child) self.pre_cont = BoxLayout (size_hint = (1, 1), padding=10, orientation='horizontal') self.pre_cont.canvas.add (Color (0,0,0,0.75)) self.pre_cont.canvas.add (Rectangle (size=self._expansion_cont.size)) _handler = Scatter () _image = Image (source = self._img.source, keep_ratio =False, allow_stretch=True) _btn = Button (text='Hide', size_hint = (0.05, 1)) def _center (wid, val): img_width = val[0]*0.75 img_height = img_width / _image.image_ratio _image.size = (img_width, img_height) _image.pos = ((val[0] - img_width)/2, (val[1] - img_height) / 2) _handler.bind (size=_center) _btn.bind (on_release =self._rmv_expanded_image) _handler.add_widget (_image) self.pre_cont.add_widget (_btn) self.pre_cont.add_widget (_handler) self._expansion_cont.add_widget (self.pre_cont)
def build(self): #f= Floatlayout() s = Scatter() l = Label(text="Hello!", font_size=150) #f.add_widget(s) s.add_widget(l) return s
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Hello!", font_size=150) f.add_widget(s) s.add_widget(l) return f
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Arbind Mehta", font_size=100) f.add_widget(s) s.add_widget(l) return f
def on_press(self): # Setup the scatter layout to show in the popup scatter = Scatter(do_rotation=False, size_int=(300, 300), scale_min=1.0, scale_max=10.0) image_source = join(globals_.photo_path, 'thumbs', basename(self.source)) image = AsyncImage(source=image_source) scatter.add_widget(image) # Resize the scatter object multiplier = 6 mat = Matrix().scale(multiplier, multiplier, multiplier) scatter.apply_transform(mat) popup = Popup(title=basename(self.source), content=scatter, size_hint=(0.8, 1), pos_hint={ 'x': 0.0, 'y': 0.0 }) popup.open()
def build(self): layout_main = BoxLayout( orientation='vertical', ) text_input = TextInput( font_size=150, height=200, size_hint_y=None, text='default', ) layout = FloatLayout() scatter = Scatter() label = Label( text="default", font_size=150, ) text_input.bind(text=label.setter('text')) layout.add_widget(scatter) scatter.add_widget(label) # Order is important - first is top/left layout_main.add_widget(text_input) layout_main.add_widget(layout) return layout_main
def show_images(self): # image_list must always contain camera_icon, otherwise image_list[0] in <Images> fails copy_list = [im for im in app.daten.image_list if not im[0].endswith(utils.camera_icon)] l = len(copy_list) if l == 0: app.do_capture() return elif l == 1: t = copy_list[0] if t[1] is None: self.show_single_image(t[0]) else: maxdim = self.app.getConfigValue("maxdim", 1024) if self.app.useGoogle: im = self.app.gphoto.getImage(t[1], maxdim) else: im = self.app.serverIntf.getImage(t[1], maxdim) if im is None: self.app.message("Kann Bild nicht laden") else: self.show_single_image(im) return self.bl.clear_widgets() for i, cp in enumerate(copy_list): im = AsyncImage(source=cp[0], on_touch_down=self.show_single_image) im.size = app.root.sm.size im.mediaId = cp[1] im.number = i # without auto_bring_to_front=False the boxlayout children are reshuffled sc = Scatter(do_rotation=False, do_translation=False, do_scale=False, size=im.size, auto_bring_to_front=False, size_hint=(None, None)) sc.add_widget(im) self.bl.add_widget(sc)
def build(self): # create a floating layout as base camlayout = FloatLayout(size=(600, 600)) cam = Camera() #Get the camera cam=Camera(resolution=(1024,1024), size=(300,300)) cam.play=True #Start the camera camlayout.add_widget(cam) button=Button(text='Take Picture',size_hint=(0.12,0.12)) button.bind(on_press=self.doscreenshot) camlayout.add_widget(button) #Add button to Camera Layout # create a text input box for site name s1 = Scatter(size_hint=(None, None), pos_hint={'x':.01, 'y':.9}) self.site = TextInput(size_hint=(None, None), size=(150, 50), multiline=False) # create a text input box for sample (flag) name s2 = Scatter(size_hint=(None, None), pos_hint={'x':.01, 'y':.8}) self.sample = TextInput(size_hint=(None, None), size=(150, 50), multiline=False) # add the text widgets to the window s1.add_widget(self.site) camlayout.add_widget(s1) s2.add_widget(self.sample) camlayout.add_widget(s2) return camlayout
def input_menu(self): ''' create containers for menu gui ''' main_layout = BoxLayout(orientation='vertical', size_hint=(None, None), size=(400,200)) button_layout = BoxLayout(orientation='horizontal') # add transparent background with main_layout.canvas.before: Color(.5, .5, .5, .2) self.rect = Rectangle(size=main_layout.size, pos=main_layout.pos) # create components label = Label(font_size=25, text='Enter Username') done_button = Button(font_size=25, text='Done') exit_button = Button(font_size=25, text='Exit') # button events done_button.bind(on_release=self.get_flickr_images) exit_button.bind(on_release=self.exit_application) # add components to containers main_layout.add_widget(label) main_layout.add_widget(textbox) button_layout.add_widget(done_button) button_layout.add_widget(exit_button) main_layout.add_widget(button_layout) s = Scatter(size_hint=(None, None), size=(450,250), pos=(300, 300), do_rotation=False, do_scale=False) s.add_widget(main_layout) self.root.add_widget(s)
def build(self): b = BoxLayout(orientation='vertical') t = TextInput(font_size=150, size_hint_y=None, height=200, text='AVE Satan !') f = FloatLayout() s = Scatter() l = Label(text='AVE Satan !', font_size=150) t.bind(text=l.setter('text')) i = AsyncImage(source="Behemoth.jpg", size_hint=(6, 6), pos_hint={ 'center_x': .5, 'center_y': .01 }) f.add_widget(s) s.add_widget(l) b.add_widget(t) b.add_widget(i) b.add_widget(f) return b
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Hello world") f.add_widget(s) s.add_widget(l) return f
def __init__(self, **kwargs): super(ImagesCarousel, self).__init__(**kwargs) for image in carousel_images: scatter = Scatter() image_to_add = Image(source=mypath+image) scatter.add_widget(image_to_add) self.add_widget(scatter)
def build(self): # 7 Создаем метод build #return Button() # 8 Пустая кнопка """9 при вводе мы получаем уже кнопку,занимающая ввесь экран, который при клике на экран меняет цвет, Здесь можно получить инфу: https://kivy.org/doc/stable/api-kivy.uix.button.html?highlight=uix#module-kivy.uix.button""" #return CodeInput(Lexer=HtmlLexer())# 17 на экране будет поле, в котором можно написать например html код s = Scatter() # 24 fl = FloatLayout(size=(300, 300)) # 21 s.add_widget(fl) # 25 """return Button(text="eto moiya pervaiya knopka", font_size=30, on_press=self.btn_press, background_color=[1,0,0,1], background_normal='') # 10 Добавим текст и чтоб было какое-то событие у кнопки красно яркого цвета""" fl.add_widget( Button(text="eto moiya pervaiya knopka", font_size=16, on_press=self.btn_press, background_color=[1, 0, 0, 1], background_normal='', size_hint=(.5, .25), pos=(640 / 2 - 160, 480 / 2 - (480 * .25 / 2)))) # 22 позиция кнопки #return fl return s """Сolor mainya proga kotoraya otvechet za cvet"""
def build(self): f = FloatLayout() s = Scatter() l = Label(text='Heloo World!!!') f.add_widget(s) s.add_widget(l) return f
def __init__(self, *args, **kwargs): super(ImagesCarousel, self).__init__(**kwargs) for image in carousel_images: scatter = Scatter(pos=(100, 200), scale=4, do_scale=True) image_to_add = Image(source=images_path + image) scatter.add_widget(image_to_add) self.add_widget(scatter)
def set_background(self): graphics_widget = FloatLayout() for td in self.textures_data: filename,xpos,ypos,width,height = td.split(":") xpos = float(xpos) ypos = float(ypos) image = MyImage(keep_ratio=True, allow_stretch=False, color=(0,0,0,0)) image.set_shadow(False) with image.canvas: Rectangle(texture=self.textures[filename].texture, size=(float(width) * X_BLOCK, float(height) * Y_BLOCK)) scatter = Scatter(do_rotation=False, do_scale=False, do_translation=False) scatter.pos = (xpos * X_BLOCK, ypos * Y_BLOCK) scatter.add_widget(image) graphics_widget.add_widget(scatter) #for td in self.sprites_data: # filename,xpos,ypos,width,height = td.split(":") # xpos = float(xpos) # ypos = float(ypos) # image = MyImage(texture = self.sprites[filename].texture, keep_ratio=True, allow_stretch=False) # image.set_shadow(False) # scatter = Scatter(do_rotation=False, do_scale=False, do_translation=False) # scatter.pos = (xpos * X_BLOCK, (ypos + 4) * Y_BLOCK / 2) # scatter.add_widget(image) # graphics_widget.add_widget(scatter) # scatter.scale = 6 - ypos * 1.5 return graphics_widget
def build(self): f = FloatLayout() s = Scatter() l = Label(text="hi there!", font_size=200) f.add_widget(s) s.add_widget(l) return f
def __init__(self, **kwargs): super(MyCarousel, self).__init__(**kwargs) self.in_anim = False global carousel carousel = self self.images = [ Image(allow_stretch=True, size=Window.size), Image(allow_stretch=True, size=Window.size), Image(allow_stretch=True, size=Window.size), Image(allow_stretch=True, size=Window.size), Image(allow_stretch=True, size=Window.size), ] self.initialized = False self.default_image = Image() if plyer.utils.platform != "android": self.default_image = Image() self._keyboard = Window.request_keyboard(self._keyboard_closed, self) self._keyboard.bind(on_key_down=self._on_keyboard_down) for image in self.images: image.displayed = None scatter = Scatter() scatter.add_widget(image) self.add_widget(scatter) self.initialized = True self.prev_index = self.index self.current_index = self.index self.initialize() self.update_images() self.start_automatic()
def add_picture(self, picture): scatter = Scatter() scatter.size = picture.size scatter.center = Window.center scatter.rotation = random.randint(-30,30) scatter.add_widget(picture) self.root.add_widget(scatter)
def __init__(self,*args, **kwargs): super(ImagesCarousel, self).__init__(**kwargs) for image in carousel_images: scatter = Scatter(pos=(100,200), scale=4, do_scale=True) image_to_add = Image(source=images_path+image) scatter.add_widget(image_to_add) self.add_widget(scatter)
class layout(FloatLayout): def __init__(self, **kwargs): super(layout, self).__init__(**kwargs) self.widgetSize = Window.size self.cadran = Image(source="cadran.png") self.add_widget(self.cadran) self.container = Scatter( size=self.widgetSize, do_rotation=False, do_scale=False, do_translation=False, ) self.needle = Image(source="needle.png", size=self.widgetSize) self.container.add_widget(self.needle) self.add_widget(self.container) Clock.schedule_interval(self.move, 1) def move(self, dt): print(self.container.center, self.cadran.center, self.needle.center) # self.container.center=self.cadran.center #self.container.rotation=45 self.container.pos_hint = {"center": (.5, .5)} self.rotateNeedle(int(time.time()) % 21 * 5) def rotateNeedle(self, speed): """rotates the value to something between minValue (mapped to 0°) to maxValue (mapped to 180°)""" minValue = 0 maxValue = 100 if speed < minValue or speed > maxValue: raise ValueError("can only display values between {} and {}", minValue, maxValue) self.container.size = Window.size self.container.rotation = speed / (maxValue - minValue) * 180 - 90
def build(self): f=FloatLayout() s=Scatter() l=Label(text='Hello World',font_size=12) f.add_widget(s) s.add_widget(l) return f
def build(self): # TODO: add a layout like this (that actually works) #self.layout = BoxLayout(orientation='vertical', spacing=10) col = Widget() self.image = AsyncImage(allow_stretch=True, keep_ratio=False, size=(480, 480)) # call this function once to load the first image self.nextImage(self) scatter = Scatter(do_rotation=False, auto_bring_to_front=False, size=self.image.get_norm_image_size()) scatter.add_widget(self.image) col.add_widget(scatter) button = Button(text='Next', size_hint=(1.0, 0.1)) button.bind(on_press=self.buttonPressed) button.bind(on_release=self.nextImage) col.add_widget(button) return col
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Hello World From Kivy", font_size=75) f.add_widget(s) s.add_widget(l) return f
def build(self): s = Scatter() fl = FloatLayout(size=(200, 200)) s.add_widget(fl) fl.add_widget( Button(text="Это кнопка", font_size=15, on_press=self.btn_press, background_color=[1, 1, 0, 1], background_normal='', size_hint=(.5, .25), pos=(10, 80))) fl.add_widget( Button(text="Это кнопка2", font_size=15, on_press=self.btn_press2, background_color=[1, 0, 0, 1], background_normal='', size_hint=(.5, .25), pos=(10, 20))) return s
def build(self): f = FloatLayout() b = Button(pos_hint={'x': 0.5, 'center_y': .5},text='Hello world', font_size=14) s = Scatter() l = Label(text="Hello!",font_size=150) def select_to(*args): try: print args[1][0] except: pass fi = FileChooserIconView() f.add_widget(s) s.add_widget(l) l.add_widget(b) def callback(instance): print('The button <%s> is being pressed' % instance.text) f.add_widget(fi) b.bind(on_press=callback) fi.bind(on_selection=select_to) return f
def build(self): main_widget = BoxLayout(orientation='horizontal') ####### chat ####### chat = BoxLayout(orientation='vertical') t = TextInput(text='default', font_size=15, size_hint_y=0.15, height=100) f = FloatLayout() s = Scatter() l = Label(text='Hello!', font_size=20, size_hint_y=0.85) t.bind(text=l.setter('text')) f.add_widget(s) s.add_widget(l) chat.add_widget(f) chat.add_widget(t) ####### end chat ####### ####### dummy ####### carte = BoxLayout(orientation='vertical') dummy_label = Label(text='Je suis un label', font_size=20) carte.add_widget(dummy_label) ####### end dummy ####### main_widget.add_widget(chat) main_widget.add_widget(carte) return main_widget
def build(self): f = FloatLayout() s = Scatter() l = Label(text='Merhaba \nEfendim!', font_size=150) f.add_widget(s) s.add_widget(l) return f
def build(self): myFloatLayout = FloatLayout() myScatter = Scatter() myLabel = Label(text="Welcome", font_size=110) myFloatLayout.add_widget(myScatter) myScatter.add_widget(myLabel) return myFloatLayout
class Simulation(FloatLayout): def __init__(self): super(Simulation, self).__init__() self.scatter = Scatter() self.b1 = Button(text="Button 1") self.label1 = Label(text=print_message()) self.add_widget(self.scatter) self.scatter.add_widget(self.label1)
def build(self): s = Scatter() l = Label(text='iPaoMi', font_size=150) s.add_widget(l) return s
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Hello!", background_color=(0, 1, 1, 1), font_size=50) f.add_widget(s) s.add_widget(l) return f
class Scatter_test(GridLayout): def __init__(self, **kwargs): super(Scatter_test, self).__init__(**kwargs) self.cols = 1 self.scatter1 = Scatter() self.imag1 = Image(source="nature1.jpg") self.scatter1.add_widget(self.imag1) self.add_widget(self.scatter1)
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Hello This is the first Kivy App", font_size=100) f.add_widget(s) s.add_widget(l) return f
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Jai Radhekrishna", font_size=12) f.add_widget(s) s.add_widget(l) return f
def on_touch_down(self, touch): #if touch.is_double_tap: x = Label(text = "HI!", font_size=150) s = Scatter(size_hint=(None, None), size=(150,150), pos=(300, 300), do_rotation=False, do_scale=False) s.add_widget(x) self.root.add_widget(s) return s
def build(self): l = Label(text='Hola!!', font_size=160) f = FloatLayout() s = Scatter() f.add_widget(s) s.add_widget(l) return f
def build(self): root = FloatLayout() size = (1024, 768) for url in urls: scatter = Scatter(size=size) bk = berkelium.Webbrowser(url=url, size=size) scatter.add_widget(bk) root.add_widget(scatter) return root
def __init__(self): super(ContainerInputs,self).__init__() s = Scatter(size_hint=(None, None), pos=(100, 30)) s.add_widget(TextInput(size_hint=(None, None), size=(100, 25))) self.add_widget(s) s = Scatter(size_hint=(None, None), pos=(300, 30)) s.add_widget(TextInput(size_hint=(None, None), size=(100, 25))) self.add_widget(s)
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Howdy", font_size=150) #Can only return one widget, so the other widgets will need to be children f.add_widget(s) s.add_widget(l) #Scatter and label are now children of float return f
def build(self): layout = BoxLayout(padding=10) scatter = Scatter() button = Button(text='My first button', background_color=(1,0,0,1)) layout.add_widget(button) label = Label(text='Hello world, this works ... awesome') scatter.add_widget(label) layout.add_widget(scatter) return layout
def build(self): layout = FloatLayout() scatter = Scatter() label = Label(text="Hello world!", font_size=150) layout.add_widget(scatter) scatter.add_widget(label) return layout
def build(self): # return a Button() as a root widget f = FloatLayout() s = Scatter() l = Label(text="Hello", font_size=150) f.add_widget(s) s.add_widget(l) return f
def build(self): f = FloatLayout() s = Scatter() l = Label(text="Hello World!", font_size=50, pos=(200,200)) f.add_widget(s) s.add_widget(l) return f
class TopDisplay(RelativeLayout): def on_parent(self, *args): self.population_data = json_load('county_population.json') self.map_view = Scatter(scale=.7) self.map_view.x += 400 self.map_view.y += 100 county_data = json_load('counties.json') for county, data in county_data.iteritems(): data['population'] = self.population_data[county] self.map_view.add_widget(County(**data)) self.add_widget(self.map_view)
def build(self): if len(argv) > 1: filename = argv[1] else: curdir = dirname(__file__) filename = join(curdir, 'softboy.avi') video = Video(source=filename, play=True) scatter = Scatter() video.bind(texture_size=scatter.setter('size')) scatter.add_widget(video) return scatter
def build(self): b = BoxLayout() t = TextInput(font_size=10) f = FloatLayout() s = Scatter() l = Label(text = u"Merhaba\nEfendim", font_size=50) f.add_widget(s) s.add_widget(l) b.add_widget(f) s.add_widget(t) return b
def create_map_controller(self): """ A scatter object to manipulate motor movement""" map_controller = Scatter( size_hint = (1,1), do_rotation=False, do_translation=True, do_scale=True,auto_bring_to_front = False) map_controller.center = Window.center # automatically determine the size based on screen size default_scale = Window.height / map_controller.height*1 # determine the size of active area map_controller.scale = default_scale # determine the amount of zoom and drag needed before moving map_controller.scale_max = default_scale*1.2 map_controller.scale_min = default_scale*0.8 # dummy object showing active area if debug_mode is True: map_controller.add_widget(Image()) def map_control_feedback(instance, value): """the callback functions for map_controller scatter object""" if debug_mode is True: if map_controller.center[0] - Window.center[0] > self.drag_x_sensitive: print('moving x+') elif map_controller.center[0] - Window.center[0] < -1* self.drag_x_sensitive: print('moving x-') elif map_controller.center[1] - Window.center[1] > self.drag_y_sensitive: print('moving y+') elif map_controller.center[1] - Window.center[1] < -1* self.drag_y_sensitive: print('moving y-') elif map_controller.scale < default_scale*0.9: print('pinch -') elif map_controller.scale > default_scale*1.1: print('pinch +') elif debug_mode is False: if map_controller.center[0] - Window.center[0] > self.drag_x_sensitive: mc.stage_library('move_x', '-') elif map_controller.center[0] - Window.center[0] < -1* self.drag_x_sensitive: mc.stage_library('move_x', '+') elif map_controller.center[1] - Window.center[1] > self.drag_y_sensitive: mc.stage_library('move_y', '-') elif map_controller.center[1] - Window.center[1] < -1*self.drag_y_sensitive: mc.stage_library('move_y', '+') elif map_controller.scale < default_scale*0.9: mc.camera_library('zoom_out') elif map_controller.scale > default_scale*1.1: mc.camera_library('zoom_in') #after taking actions, reset scatter location and scale to default map_controller.center = Window.center map_controller.scale = default_scale map_controller.bind(on_touch_up = map_control_feedback) return map_controller
def build(self): b = BoxLayout(orientation="vertical", padding=[50,5,50,450]) t = TextInput(font_size=50) f = FloatLayout() s = Scatter() l = Label(font_size=150) t.bind(text=l.setter("text")) f.add_widget(s) s.add_widget(l) b.add_widget(f) b.add_widget(t) return b
def build(self): b = BoxLayout(orientation='vertical') t = TextInput(font_size=150) f = FloatLayout() s = Scatter() l = Label(text="Hello!", font_size=150) f.add_widget(s) s.add_widget(l) b.add_widget(f) b.add_widget(t) return b
def build(self): float = FloatLayout() # define the float layout (enables a dynamic screen) scatt = Scatter() # create a scatter scattTwo = Scatter() # create a second scatter but = Button(text="test", # create a button with large font size background_color=(0,.5,0,1), font_size=150) butTwo = Button() # create a button with no font float.add_widget(scatt) # add the first scatter float.add_widget(scattTwo) # add the second scatter scatt.add_widget(but) # add the first button to the first scatter scattTwo.add_widget((butTwo)) # add the second button to the second scatter return float # return the float layout
def build(self): b = BoxLayout(orientation='vertical') t = TextInput(font_size=20,size_hint_y=None,height=200,on_text=self.change_label_colour) f = FloatLayout() s = Scatter() l = Label(text="Hello!",font_size=50,id='my_label') f.add_widget(s) s.add_widget(l) b.add_widget(t) b.add_widget(f) t.bind(text=l.setter('text')) return b
def show_gems(self, dt=None, dummy=None): self.gem_scatters = [] filler = (8 - len(self.weapons)) / 2.0 for i in range(len(self.weapons)): gem = self.gems[self.weapons[i]] scatter = Scatter(do_rotation=False, do_scale=False, color=(0,0,0,0), size_hint=(0.1,0.1)) scatter.add_widget(gem) gem.bind(on_touch_down=self.flash_hero) scatter.bind(on_touch_up=self.drop_gem) scatter.pos = ((filler + i) * X_BLOCK, 0) scatter.scale = 1 try: self.graphics_widget.add_widget(scatter) self.gem_scatters.append(scatter) except: pass
def build(self): # top level root widget, aligns children horizontally from the left automatically b = BoxLayout() # set up the first child widget t = TextInput(font_size=50) # set up the second child widget f = FloatLayout() s = Scatter() l = Label(text='Hello!', font_size=50) f.add_widget(s) s.add_widget(l) # now add the sub-widgets to b b.add_widget(f) b.add_widget(t) return b # return b since it contains everything else
def create_map_controller(): map_controller = Scatter( size_hint = (1,1), do_rotation=False, do_translation=True, do_scale=True, scale = 1, center = Window.center) # automatically determine the size based on screen size default_scale = Window.height / map_controller.height*0.75 # determine the size of active area map_controller.scale = default_scale # determine the amount of zoom and drag needed before moving map_controller.scale_max = default_scale*1.2 map_controller.scale_min = default_scale*0.8 x_sensitive = Window.width*0.3 y_sensitive = Window.height*0.3 # dummy object showing active area map_controller.add_widget(Image()) def map_control_feedback(instance, value): """the callback functions for map_controller scatter object""" if map_controller.center[0] - Window.center[0] > x_sensitive: #microscope_control.drag_right() print('moving x+') elif map_controller.center[0] - Window.center[0] < -1* x_sensitive: #microscope_control.drag_left() pass elif map_controller.center[1] - Window.center[1] > y_sensitive: #microscope_control.drag_top() print('moving y+') elif map_controller.center[1] - Window.center[1] < -1*y_sensitive: #microscope_control.drag_bot() pass elif map_controller.scale < default_scale*0.9: #microscope_control.pinch_out() print('pinch') elif map_controller.scale > default_scale*1.1: #microscope_control.pinch_in() pass #after taking actions, reset scatter location and scale to default map_controller.center = Window.center map_controller.scale = default_scale map_controller.bind(on_touch_up = map_control_feedback) return map_controller