コード例 #1
0
 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)
コード例 #2
0
    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
コード例 #3
0
 def build(self):
     f = FloatLayout()
     s = Scatter()
     l = Label(text="Hello", font_size=150)
     f.add_widget(s)
     s.add_widget(l)
     return f
コード例 #4
0
    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)
コード例 #5
0
 def build(self):
     #f= Floatlayout()
     s = Scatter()
     l = Label(text="Hello!", font_size=150)
     #f.add_widget(s)
     s.add_widget(l)
     return s
コード例 #6
0
ファイル: oi.py プロジェクト: pythonprobr/kivy
 def build(self):
     f = FloatLayout()
     s = Scatter()
     l = Label(text="Hello!", font_size=150)
     f.add_widget(s)
     s.add_widget(l)
     return f
コード例 #7
0
ファイル: VChat.py プロジェクト: Arbind15/Python-Projects
 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
コード例 #8
0
    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()
コード例 #9
0
    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
コード例 #10
0
 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)
コード例 #11
0
          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
コード例 #12
0
ファイル: main.py プロジェクト: shrootz/Kivy
 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)
コード例 #13
0
ファイル: Hello_Satan_2.py プロジェクト: Slawecky/Sec_Python
    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
コード例 #14
0
ファイル: kivyTest.py プロジェクト: jherreral/kivySoe
 def build(self):
     f = FloatLayout()
     s = Scatter()
     l = Label(text="Hello world")
     f.add_widget(s)
     s.add_widget(l)
     return f
コード例 #15
0
ファイル: main.py プロジェクト: tsartsaris/pythess_kivy
 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)
コード例 #16
0
 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"""
コード例 #17
0
 def build(self):
     f = FloatLayout()
     s = Scatter()
     l = Label(text='Heloo World!!!')
     f.add_widget(s)
     s.add_widget(l)
     return f
コード例 #18
0
 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)
コード例 #19
0
ファイル: main.py プロジェクト: ubuntunux/KivyProject
    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
コード例 #20
0
ファイル: Label.py プロジェクト: mitchwong2021/CS61A
 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
コード例 #21
0
ファイル: main.py プロジェクト: Konubinix/KivySlideshow
    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()
コード例 #22
0
ファイル: pictures.py プロジェクト: aidanok/kivy
 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)
コード例 #23
0
ファイル: main.py プロジェクト: skorokithakis/pythess-files
 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)
コード例 #24
0
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
コード例 #25
0
 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
コード例 #26
0
ファイル: main.py プロジェクト: muralig/horseshoe
    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
コード例 #27
0
ファイル: main.py プロジェクト: JesterOrNot/Time
 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
コード例 #28
0
    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
コード例 #29
0
ファイル: after.py プロジェクト: tanayz/kivyapp
    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
コード例 #30
0
    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
コード例 #31
0
ファイル: main.py プロジェクト: mustafa-altinisik/test2
 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
コード例 #32
0
    def build(self):
        myFloatLayout = FloatLayout()
        myScatter = Scatter()
        myLabel = Label(text="Welcome", font_size=110)

        myFloatLayout.add_widget(myScatter)
        myScatter.add_widget(myLabel)
        return myFloatLayout
コード例 #33
0
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)
コード例 #34
0
ファイル: kivy_frame.py プロジェクト: jeepx5/serdes_app
    def build(self):
        s = Scatter()

        l = Label(text='iPaoMi', font_size=150)

        s.add_widget(l)

        return s
コード例 #35
0
ファイル: main.py プロジェクト: singh707/pi_blood
    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
コード例 #36
0
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)
コード例 #37
0
ファイル: main.py プロジェクト: kirtiwardhan-18/FirstAppTrial
    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
コード例 #38
0
    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
コード例 #39
0
ファイル: main.py プロジェクト: shrootz/Kivy
 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
コード例 #40
0
ファイル: DiegoApp.py プロジェクト: diego1254/DiegoApp
    def build(self):
        l = Label(text='Hola!!',  font_size=160)
        f = FloatLayout()
        s = Scatter()

        f.add_widget(s)
        s.add_widget(l)
        return f
コード例 #41
0
ファイル: main.py プロジェクト: PHPDOTSQL/kivy-berkelium
 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
コード例 #42
0
	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)
コード例 #43
0
ファイル: main.py プロジェクト: s-amon-s/Programming
    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
コード例 #44
0
ファイル: scatter.py プロジェクト: himelys/VideoStream
 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
コード例 #45
0
ファイル: scatter0.py プロジェクト: afodor88/curs_python
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)
コード例 #46
0
ファイル: main.py プロジェクト: RexMidas/python-kivy
 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
コード例 #47
0
    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
コード例 #48
0
ファイル: main.py プロジェクト: tsartsaris/android
    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
コード例 #49
0
ファイル: main.py プロジェクト: Allan-Shand/KivyTesting
	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
コード例 #50
0
ファイル: population_map.py プロジェクト: fresk/shs
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)
コード例 #51
0
 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
コード例 #52
0
ファイル: deneme.py プロジェクト: mustafa-altinisik/test2
    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
コード例 #53
0
    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
コード例 #54
0
ファイル: kivy_tutorial.py プロジェクト: Exodus111/Projects
    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
コード例 #55
0
ファイル: main.py プロジェクト: datalater/python34.kivy
    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
コード例 #56
0
    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
コード例 #57
0
ファイル: main.py プロジェクト: tanayz/kivyapp
    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
コード例 #58
0
ファイル: main.py プロジェクト: ubuntunux/KivyProject
 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
コード例 #59
0
	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
コード例 #60
0
ファイル: front-end.py プロジェクト: herbzhao/WaterScope-RPi
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