예제 #1
0
 def build(self):
   base = Widget()
   ss = ScreenSaver()
   Clock.schedule_interval(ss.start, 2)
   base.add_widget(ss)
   
   return base
예제 #2
0
 def build(self):
     root = Widget()
     root.add_widget(Button())
     slider = Slider()
     root.add_widget(slider)
     # root.add_widget(MyPaintWidget())
     return root
예제 #3
0
 def build(self):
     parent = Widget()
     app = GUI()
     # game clock
     Clock.schedule_interval(app.update, 1.0 / 60.0)
     parent.add_widget(app)
     return parent
예제 #4
0
def Index():
    Index = Widget()
    banner_and_background(Index)
    with Index.canvas:
        Color(0.3, 0.3, 0.3, 0.9)
        Rectangle(pos=(40, 50), size=(500, 400))
        Color(0.2, 0.2, 0.2, 1)
        Rectangle(pos=(60, 50), size=(480, 400))
        Color(0.3, 0.3, 0.3, 0.9)
        Rectangle(pos=(580, 50), size=(200, 400))
        Color(0.2, 0.2, 0.2, 1)
        Rectangle(pos=(590, 60), size=(180, 340))
    subhead(Index, "Users", 630, 375)
    subhead(Index, "Your Boxes", 250, 375)

    res = requests.get(url="https://ichatb.herokuapp.com/getusers").json()

    set = []

    for i in res['data']:
        if (i['userid'] != userid[0]):
            set.append(Badge(i['userid'], New, data=i['userid']))

    Index.add_widget(scrollgrid(Index, set, pos=(590, 60), size=(180, 340)))

    set = []

    for i in boxids[0]:
        set.append(Card(text=str(i)))

    Index.add_widget(scrollgrid(Index, set, pos=(60, 60), size=(480, 340)))

    Clock.schedule_once(Reload, 20)

    return Index
예제 #5
0
    def build(self):
        wid = Widget()
        f = FloatLayout()
        wid.add_widget(f)

        label = Label(text='0')

        btn_add100 = Button(
            text='+ new node',
            on_press=partial(self.add_node, label, f, 1))

        btn_reset = Button(
            text='Reset',
            on_press=partial(self.add_node, label, f))

        layout = BoxLayout(size_hint=(1, None), height=50)
        layout.add_widget(btn_add100)
        layout.add_widget(btn_reset)
        layout.add_widget(label)

        root = BoxLayout(orientation='vertical')
        root.add_widget(wid)
        root.add_widget(layout)

        return root
예제 #6
0
    def build(self):
        widget = Widget()
        other = Widget()
        widget.add_widget(other)
        widget.remove_widget(other)

        return Window()
예제 #7
0
	def build(self):
		#create window
		root = Widget()
		root.size = Window.size
		root.center = Window.center

		#create map
		Map.tileSet = TileFactory
		board = Map(size=(504,504))
		root.add_widget(board.getDisplayRoot())

		#add starting tile
		tile_fact = TileFactory()
		for i in range(1):
			btn = tile_fact.newTile(board)
			board.addPiece(btn,(i*126,i*126))

		#create players
		CurrentTile.map = board
		CurrentTile.tile_size = TileFactory.size

		playerTile = CurrentTile()
	
		newTile = tile_fact.newTile(board)
		root.add_widget(playerTile)

		playerTile.resetTile(newTile)

		return root
예제 #8
0
 def build(self):
     parent = Widget()
     clear_btn = Button(text='Restore')
     clear_btn.bind(on_release=self.restore)
     parent.add_widget(self.painter)
     parent.add_widget(clear_btn)
     return parent
예제 #9
0
	def build(self):
		win = Widget()
		fc1 = FileChooserListView(size=(160,150), pos=(670,260))
		fc2 = FileChooserIconView(size=(160,150), pos=(670,120))
		win.add_widget(fc1)
		win.add_widget(fc2)
		return win
예제 #10
0
 def build(self):
     cb = CefBrowser(url="http://mindmeister.com")
     w = Widget()
     w.add_widget(cb)
     #cb.pos = (100, 10)
     #cb.size = (1720, 480)
     return cb
예제 #11
0
    def build(self):
        root = Widget()
        root.bind(on_touch_move=self.generate_one)
        aabb = b2AABB()
        aabb.lowerBound = b2Vec2(0, 0)
        aabb.upperBound = b2Vec2(10000, 10000)
        self.world = world = b2World(
                aabb, b2Vec2(0, -100), True)

        # plane for the ground, all other the window.
        # Define the ground body.
        groundBodyDef = b2BodyDef()
        groundBodyDef.position = [0, 0]
        # Call the body factory which allocates memory for the ground body
        # from a pool and creates the ground box shape (also from a pool).
        # The body is also added to the world.
        groundBody = world.CreateBody(groundBodyDef)
        # Define the ground box shape.
        groundShapeDef = b2PolygonDef()
        # The extents are the half-widths of the box.
        groundShapeDef.SetAsBox(10000, 1)
        # Add the ground shape to the ground body.
        groundBody.CreateShape(groundShapeDef)

        # generate circles
        self.circles = []
        for x in xrange(5):
            c = Circle(y=500 + x * 5, x=500+x, world=world)
            self.circles.append(c)
            root.add_widget(c)
        Clock.schedule_interval(self._update_world, 1 / 60.)

        return root
def test_has_parent(ignore_parent):
    import weakref
    from kivy.uix.widget import Widget
    from kivy_garden.draggable import save_widget_location
    parent = Widget()
    w = Widget()
    parent.add_widget(w)
    parent.add_widget(Widget())
    location = save_widget_location(w, ignore_parent=ignore_parent)
    expectation = {
        'x': 0,
        'y': 0,
        'width': 100,
        'height': 100,
        'size_hint_x': 1,
        'size_hint_y': 1,
        'pos_hint': {},
        'size_hint_min_x': None,
        'size_hint_min_y': None,
        'size_hint_max_x': None,
        'size_hint_max_y': None,
        'weak_parent': weakref.ref(parent),
        'index': 1,
    }
    if ignore_parent:
        del expectation['weak_parent']
        del expectation['index']
    assert location == expectation
예제 #13
0
    def build(self):
        root = Widget()
        puzzle = Puzzle(resolution=(640, 480), play=True)

        root.add_widget(puzzle)

        return root
예제 #14
0
 def build(self):
     screen = Widget()
     play_button = Button()
     play_button.text = 'Play ►'
     play_button.on_press = self.play
     screen.add_widget(play_button)
     return screen
예제 #15
0
 def build(self):
     parent = Widget()
     clear_btn = Button(text='Clear')
     clear_btn.bind(on_release=self.clear_canvas)
     parent.add_widget(self.painter)
     parent.add_widget(clear_btn)
     return parent
예제 #16
0
    def on_enter(self):
        parent = GridLayout(cols=1)
        self.painter = MyPaintWidget(size=Window.size)

        self.lista = sorted(self.lang["translate"].keys())
        self.ktora_litera = 0
        self.textw = Label(
            text=self.lista[self.ktora_litera], font_size='500sp')

        self.layout_top = builder.Builder.load_file("proba_pisanie.kv")
        self.layout_top.ids.check.bind(on_release=self.check_accuracy2)
        self.layout_top.ids.clear_b.bind(on_release=self.clear_canva)
        self.layout_top.ids.next.bind(on_release=self.zmien_litera(+1))
        self.layout_top.ids.prev.bind(on_release=self.zmien_litera(-1))

        parent.add_widget(self.layout_top)

        parent2 = Widget()
        parent2.add_widget(self.textw)
        parent2.add_widget(self.painter)
        parent.add_widget(parent2)

        self.painter.size = Window.size
        self.textw.size = Window.size

        self.add_widget(parent)
예제 #17
0
    def build(self):
        def on_act(*args):
            print "OK"
            print args[0], args[1]

        parent = Widget()

        layout = GridLayout(rows=1, spacing=5, size_hint_y=None)

        layout.bind(minimum_height=layout.setter('height'))

        btn1 = CheckBox(size=(25, 25), group="gr1")
        layout.add_widget(btn1)
        btn1.bind(active=on_act)

        btn2 = CheckBox(size=(25, 25), group="gr1")
        layout.add_widget(btn2)
        btn2.bind(active=on_act)

        btn3 = CheckBox(size=(25, 25), group="gr1")
        layout.add_widget(btn3)
        btn3.bind(active=on_act)

        btn4 = CheckBox(size=(25, 25), group="gr1")
        layout.add_widget(btn4)
        btn4.bind(active=on_act)

        parent.add_widget(layout)

        return parent
예제 #18
0
 def build(self):
     parent = Widget()
     hitbtn = Button(text="hit", pos=(10, 10))
     standbtn = Button(text="stand", pos=(100, 100))
     parent.add_widget(hitbtn)
     parent.add_widget(standbtn)
     return parent
예제 #19
0
    def __init__(self,**kwargs):
        super(Medicine,self).__init__(**kwargs)
        self.active_checkboxes = []
        self.checkboxeslist = []
        self.scrollsize = fullapp.size[0]*0.86,fullapp.size[1]*0.57
        self.scrollpos = fullapp.size[0]*0.07,fullapp.size[1]*0.34

        self.canvas.add(Rectangle(size=fullapp.size,pos=fullapp.pos,source="MainBackgroundWhiter.png"))
        self.add_widget(MenuButton())
        rect = Rectangle(size=(fullapp.size[0],fullapp.size[1]*0.236),pos=fullapp.pos,source='FrontForScroll.png')
        self.canvas.add(rect)
        self.canvas.add(Color(0.5,0.5,0.5,1))
        self.canvas.add(Rectangle(size=self.scrollsize,pos=self.scrollpos))

        MedScroll = ScrollView()
        MedScroll.size_hint = (None,None)
        MedScroll.size = self.scrollsize
        MedScroll.pos = self.scrollpos

        MedBox = Widget()
        MedBox.size_of_drug = (self.scrollsize[0],fullapp.size[1]*0.1)
        MedBox.spacing = fullapp.size[1]*0.01
        MedBox.size = (self.scrollsize[0],(MedBox.spacing+MedBox.size_of_drug[1])*len(IlnessBase.Medicine)-MedBox.spacing)
        MedBox.size_hint_y = None

        for i in range(len(IlnessBase.Medicine)):
            text = Label(color=(1,1,1,1),markup=True)
            text.text = IlnessBase.Medicine[i][:IlnessBase.Medicine[i].find(':')] + '  ' + '[i][size=11][color=272727]' + 'ATX num ' + IlnessBase.Medicine[i][IlnessBase.Medicine[i].find(':')+1:] + '[/i][/size][/color]'
            text.text_size = MedBox.size_of_drug
            text.text_size[0] -= MedBox.size_of_drug[1]
            text.halign = 'left'
            text.valign = 'middle'
            text.pos = (MedBox.size_of_drug[0]/4.3,i*(MedBox.spacing+MedBox.size_of_drug[1])-MedBox.size_of_drug[1]/2)
            b = Button(size=MedBox.size_of_drug,pos=(0,i*(MedBox.spacing+MedBox.size_of_drug[1])))
            b.bind(on_press=self.on_button)
            b.add_widget(text)
            checkbox = CheckBox(size=(MedBox.size_of_drug[1],MedBox.size_of_drug[1]),pos = (MedBox.size_of_drug[0]-MedBox.size_of_drug[1],i*(MedBox.spacing+MedBox.size_of_drug[1])))
            checkbox.num = i
            checkbox.bind(active=self.on_checkbox)
            b.add_widget(checkbox)
            self.checkboxeslist.append(checkbox)
            b.ATXNum = IlnessBase.Medicine[i][IlnessBase.Medicine[i].find(':')+1:]
            MedBox.add_widget(b)

        TopLabel = Label(bold=True,size_hint=(None,None),text='check prep:',font_size=fullapp.size[1]*0.036,color = (0,0,0,1),pos = (fullapp.size[0]*0.34,fullapp.size[1]*0.85))
        
        self.SomeWidget = Widget(pos=(0,0),size_hint=(None,None),size = fullapp.size)
        CancelButton = Button(text = 'exit',font_size=fullapp.size[1]*0.022,size_hint=(None,None),size=(MedBox.size_of_drug[0]/2.01,fullapp.size[1]*0.05),
            pos = (self.scrollpos[0],self.scrollpos[1]-fullapp.size[1]*0.05-1),background_color = (0.3,0.3,0.9,1),on_press=self.on_cancel)
        OkButton = Button(text = 'chose',font_size=fullapp.size[1]*0.022,size_hint=(None,None),size=(MedBox.size_of_drug[0]/2.01,fullapp.size[1]*0.05),
            pos = (self.scrollpos[0]+MedBox.size_of_drug[0]/2+1,self.scrollpos[1]-fullapp.size[1]*0.05-1),background_color = (0.3,0.3,0.9,1),on_press=self.on_choose)
        
        self.SomeWidget.add_widget(CancelButton)
        self.SomeWidget.add_widget(OkButton)
        self.SomeWidget.opacity=0

        MedScroll.add_widget(MedBox)
        self.add_widget(self.SomeWidget)
        self.add_widget(MedScroll)
        self.add_widget(TopLabel)
예제 #20
0
    def _key_handler(self, a, b, c, d, e):
        if b == 1001 and self.bPopup == False:
            self.bPopup = True
            content = Widget()
            sizehintW = 0.9
            sizehintH = 0.2
            btnSizeW = rootW * sizehintW * 0.5
            btnSizeH = rootH * sizehintH * 0.5
            popup = Popup(title="Exit?",
                          content=content,
                          auto_dismiss=False,
                          size_hint=(sizehintW, sizehintH))
            content.pos = popup.pos
            btn_Yes = Button(text='Yes',
                             pos=(cx - btnSizeW * 0.1 - btnSizeW * 0.75,
                                  cy - btnSizeH * 0.5),
                             size=(btnSizeW * 0.75, btnSizeH * 0.75))
            btn_No = Button(text='No',
                            pos=(cx + btnSizeW * 0.1, cy - btnSizeH * 0.5),
                            size=(btnSizeW * 0.75, btnSizeH * 0.75))
            content.add_widget(btn_Yes)
            content.add_widget(btn_No)

            def closePopup(instance):
                popup.dismiss()
                self.bPopup = False

            btn_Yes.bind(on_press=self.stop)
            btn_No.bind(on_press=closePopup)
            popup.open()
예제 #21
0
class NumberApp(App):
    def buildNums(self):

        for i in range(1, 11):
            print i
            btn = Button(text=str(i),
                         pos=(150 * (i - 1) + 192, 0),
                         size=(150, 100),
                         background_color=(1, 0, 1, 0.3),
                         color=(1, 1, 1, 1))
            btn.bind(on_press=self.main._press)

            self.parent.add_widget(btn)

    def build(self):

        self.parent = Widget()

        self.main = NumberWidget()

        self.buildNums()
        Clock.schedule_interval(self.main.update, 1.0 / 60.0)
        self.parent.add_widget(self.main)

        return self.parent
def test_weak_parent_is_dead(location_factory, ignore_parent, has_parent):
    import gc
    import weakref
    from kivy.uix.widget import Widget
    from kivy_garden.draggable import restore_widget_location
    loc = location_factory()
    loc['weak_parent'] = weakref.ref(Widget())
    loc['index'] = 0
    gc.collect()
    assert loc['weak_parent']() is None
    w = Widget()
    if has_parent:
        parent = Widget()
        parent.add_widget(w)
        parent.add_widget(Widget())
        assert parent.children.index(w) == 1
    if ignore_parent:
        restore_widget_location(w, loc, ignore_parent=True)
    else:
        with pytest.raises(ReferenceError):
            restore_widget_location(w, loc, ignore_parent=False)
    if has_parent:
        assert w.parent is parent
        assert parent.children.index(w) == 1
    else:
        assert w.parent is None
예제 #23
0
 def build(self):
     root_widget = Widget()
     button_1 = Button(pos=(100, 100))
     button_2 = Button(pos=(100, 300))
     root_widget.add_widget(button_1)
     root_widget.add_widget(button_2)
     return root_widget
예제 #24
0
 def build(self):
     parent = Widget()
     self.parent = parent
     self.painter = MyPaintWidget()
     parent.add_widget(self.painter)
     Window.bind(on_key_down=self.key_action)
     return parent
예제 #25
0
 def build(self):
     root_widget = Widget()
     button_1 = Button()
     button_2 = Button()
     root_widget.add_widget(button_1)
     root_widget.add_widget(button_2)
     return root_widget
예제 #26
0
    def build(self):
        root = Widget()
        puzzle = Puzzle(resolution=(640, 480), play=True)

        root.add_widget(puzzle)

        return root
예제 #27
0
    def build(self):
        root = Widget()
        root.bind(on_touch_move=self.generate_one)
        aabb = b2AABB()
        aabb.lowerBound = b2Vec2(0, 0)
        aabb.upperBound = b2Vec2(10000, 10000)
        self.world = world = b2World(aabb, b2Vec2(0, -100), True)

        # plane for the ground, all other the window.
        # Define the ground body.
        groundBodyDef = b2BodyDef()
        groundBodyDef.position = [0, 0]
        # Call the body factory which allocates memory for the ground body
        # from a pool and creates the ground box shape (also from a pool).
        # The body is also added to the world.
        groundBody = world.CreateBody(groundBodyDef)
        # Define the ground box shape.
        groundShapeDef = b2PolygonDef()
        # The extents are the half-widths of the box.
        groundShapeDef.SetAsBox(10000, 1)
        # Add the ground shape to the ground body.
        groundBody.CreateShape(groundShapeDef)

        # generate circles
        self.circles = []
        for x in xrange(5):
            c = Circle(y=500 + x * 5, x=500 + x, world=world)
            self.circles.append(c)
            root.add_widget(c)
        Clock.schedule_interval(self._update_world, 1 / 60.)

        return root
예제 #28
0
파일: main.py 프로젝트: xhalo32/advpy
    def build(self):
        parent = Widget()
        self.painter = MyPaintWidget()

        clearbtn = Button(text='Clear')
        clearbtn.bind(on_release=self.clear_canvas)

        Gbtn = Button(text='GREEN', pos=(100, 0))
        Gbtn.bind(on_release=self.green_color)

        Rbtn = Button(text='RED', pos=(200, 0))
        Rbtn.bind(on_release=self.red_color)

        Bbtn = Button(text='BLUE', pos=(300, 0))
        Bbtn.bind(on_release=self.blue_color)

        Mbtn = Button(text='MAGENTA', pos=(400, 0))
        Mbtn.bind(on_release=self.mag_color)

        parent.add_widget(self.painter)
        parent.add_widget(self.painter.slider)

        parent.add_widget(clearbtn)
        parent.add_widget(Gbtn)
        parent.add_widget(Rbtn)
        parent.add_widget(Bbtn)
        parent.add_widget(Mbtn)

        return parent
예제 #29
0
파일: control.py 프로젝트: tamu-vscl/pyVP21
 def build(self):
     self.widgets = dict()
     self.parseConfiguration()
     parent = Widget()
     layout = GridLayout(cols=self.numProj,
                         size=(self.numProj * 100, 500),
                         row_default_height=10)
     for id_ in xrange(self.numProj):
         self.widgets[id_] = dict()
         self.widgets[id_]['lbl'] = Label(text=self.proj[id_]['name'],
                                          size=(100,25),
                                          size_hint_y=None)
         layout.add_widget(self.widgets[id_]['lbl'])
     for id_ in xrange(self.numProj):
         self.widgets[id_]['pwr'] = ToggleButton(text='Off',
                                                 size=(100, 25),
                                                 size_hint_y=None)
         layout.add_widget(self.widgets[id_]['pwr'])
     for id_ in xrange(self.numProj):
         self.widgets[id_]['hdmi'] = ToggleButton(text='HDMI',
                                                  state='down',
                                                  size=(100, 25),
                                                  size_hint_y=None,
                                                  group='video%s' % id_)
         layout.add_widget(self.widgets[id_]['hdmi'])
     for id_ in xrange(self.numProj):
         self.widgets[id_]['vga'] = ToggleButton(text='VGA',
                                                 state='normal',
                                                 size=(100, 25),
                                                 size_hint_y=None,
                                                 group='video%s' % id_)
         layout.add_widget(self.widgets[id_]['vga'])            
     parent.add_widget(layout)
     return parent
예제 #30
0
    def __init__(self, *args):
        super(Game, self, *args).__init__(*args)
        user_data_dir = App.get_running_app().user_data_dir
        imgdir = os.path.join(user_data_dir,'images')
        
        if os.path.isdir(imgdir) and len(os.listdir(imgdir))>0:
            imglist = os.listdir(imgdir)
            
            for img in imglist:
                background = Background(source=os.path.join(imgdir,img))
                
                widget = Widget()
                
                button = Button(text='+')
                button.pos = [20,20]
                button.bind(on_press=self.nextScreen)
                
                widget.add_widget(background)
                widget.add_widget(button)
                
                
                screen = Screen()
                screen.name = img
                screen.add_widget(widget)
                self.add_widget(screen)

                Clock.schedule_interval(background.update, 1.0/60.0)
        else:
            if not os.path.isdir(imgdir):
                os.makedirs(imgdir)
                
            screen = Screen()
            screen.add_widget(Label(text='no images at: '+imgdir))
            self.add_widget(screen)
예제 #31
0
def Index():
    Index = Widget()
    banner_and_background(Index)

    def fun1(event):
        root.clear_widgets()
        root.add_widget(User())

    b1 = Button()
    b1.text = "User"
    b1.font_size = "28sp"
    b1.size = (200, 200)
    b1.pos = (200, 200)
    b1.background_color = (255, 1, 1, 1)
    b1.bind(on_press=fun1)
    Index.add_widget(b1)

    def fun2(event):
        root.clear_widgets()
        root.add_widget(Course())

    b2 = Button()
    b2.text = "Course"
    b2.font_size = "28sp"
    b2.size = (200, 200)
    b2.pos = (400, 200)
    b2.background_color = (255, 1, 1, 1)
    b2.bind(on_press=fun2)
    Index.add_widget(b2)

    return Index
예제 #32
0
파일: main.py 프로젝트: sroskom/umbrella
    def fadeToBlack(self, *args):
        self.endingFadeCol.a += .02
        if self.endingFadeCol.a >= 1:
            gameWid = Widget(size=self.size)
            self.gameWidBack1 = Widget(size=self.size)
            self.gameWidBack2 = Widget(size=self.size)
            #self.gameWidBack1.canvas.bind(pos=self.gameWidBack1.pos)
            self.gameWidBack2.pos = [self.gameWidBack2.width * (-1), 0]
            backs = [self.gameWidBack1, self.gameWidBack2]
            for i in backs:
                with i.canvas:
                    Color(*[.9, .9, .8, .2])
                    if i == backs[0]:
                        self.back_1pattern = self.pattern3()
                    else:
                        self.back_2pattern = self.pattern3()
                gameWid.add_widget(i)

            for i in self.back_1pattern:
                i.pos = self.gameWidBack1.pos[0] + i.pos[0], i.pos[1]
            for i in self.back_2pattern:
                i.pos = self.gameWidBack2.pos[0] + i.pos[0], i.pos[1]
            Clock.schedule_interval(self.moveGameArea, 3.0 / 60.0)
            self.parent.add_widget(gameWid)
            self.parent.remove_widget(self)
            #self.pattern4Buttons()
            return False
예제 #33
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
예제 #34
0
 def build(self):
     Window.set_title("Headlines")
     parent = Widget()
     app = GUI()
     Clock.schedule_interval(app.update, 60)
     parent.add_widget(app)
     return parent
예제 #35
0
파일: main.py 프로젝트: xhalo32/advpy
	def build( self ):
		parent = Widget(  )
		self.painter = MyPaintWidget(  )

		clearbtn = Button( text='Clear' )
		clearbtn.bind( on_release=self.clear_canvas )
		
		Gbtn = Button( text='GREEN', pos=( 100, 0 ) )
		Gbtn.bind( on_release=self.green_color )
				
		Rbtn = Button( text='RED', pos=( 200, 0 ) )
		Rbtn.bind( on_release=self.red_color )

		Bbtn = Button( text='BLUE', pos=( 300, 0 ) )
		Bbtn.bind( on_release=self.blue_color )
					
		Mbtn = Button( text='MAGENTA', pos=( 400, 0 ) )
		Mbtn.bind( on_release=self.mag_color )
		
		parent.add_widget(self.painter)
		parent.add_widget(self.painter.slider)

		parent.add_widget(clearbtn)
		parent.add_widget(Gbtn)
		parent.add_widget(Rbtn)
		parent.add_widget(Bbtn)
		parent.add_widget(Mbtn)

		return parent
예제 #36
0
    def build(self):
        Window.clearcolor = (1, 1, 1, 1)
        parent = Widget()
        self.painter = MyPaintWidget()
        self.painter.canvas.add(Color(0, 0, 0))
        btnsbox = BoxLayout(size_hint=(1, 0.2))

        clearbtn = Button(text='Clear')
        clearbtn.bind(on_release=self.clear_canvas)

        redbtn = Button(text='Red Color', on_press=self.red_mode)
        greenbtn = Button(text='Green Color', on_press=self.green_mode)
        bluebtn = Button(text='Blue Color', on_press=self.blue_mode)
        randombtn = Button(text='Random Color', on_press=self.random_mode)

        parent.add_widget(self.painter)
        btnsbox.add_widget(clearbtn)
        btnsbox.add_widget(redbtn)
        btnsbox.add_widget(greenbtn)
        btnsbox.add_widget(bluebtn)
        btnsbox.add_widget(randombtn)

        window = BoxLayout(orientation='vertical')

        window.add_widget(parent)
        window.add_widget(btnsbox)
        return window
예제 #37
0
    def create_search(self):
        self.clear()
        global ilnesssearch
        ilnesssearch = IlnessSearch()
        scrollview = ScrollView()
        scrollview.add_widget(ilnesssearch)
        BackForScroll = Widget()
        WhiteWidget = Widget()
        FrontForScroll = Widget(size=(fullapp.size[0],fullapp.size[1]*0.236))

        WhiteWidget.canvas.add(Color(1,1,1))
        Whiterect = Rectangle(size=fullapp.size,pos=fullapp.pos)
        WhiteWidget.canvas.add(Whiterect)
        WhiteWidget.opacity = 0.5
        FrontForScroll.canvas.clear()
        FrontForScroll.canvas.add(Color(1,1,1))
        rect = Rectangle(size=fullapp.size,pos=fullapp.pos,source='MainBackground.png')
        BackForScroll.canvas.add(rect)
        BackForScroll.add_widget(WhiteWidget)
        rect = Rectangle(size=FrontForScroll.size,pos=fullapp.pos,source='FrontForScroll.png')
        FrontForScroll.canvas.add(rect)
        ilnesssearch.MenuButton = MenuButton()
    
        fullapp.add_widget(BackForScroll)
        fullapp.add_widget(scrollview)
        fullapp.add_widget(FrontForScroll)
        fullapp.add_widget(ilnesssearch.MenuButton)
        fullapp.add_widget(Widget(size=(100,100),size_hint=(None,None),pos=(100,100)))
        ilnesssearch.add_unit(0)
        fullapp.state = "IlnessSearch"
예제 #38
0
	def build(self):
		# Will hold the painting canvas and the buttons (could also use layout)
		parent = Widget()
		self.painter = MyPaintWidget()

		# Create the necessary buttons 
		circle = Button(text='Circle')
		rect = Button(text='Rectangle')
		triangle = Button(text='Triangle')
		clear = Button(text='Clear')

		circle.set_center_y(150)
		rect.set_center_y(250)
		triangle.set_center_y(350)

		# Bind the buttons' on release events to callback functions
		circle.bind(on_release=self.painter.add_circle)
		rect.bind(on_release=self.painter.add_rect)
		triangle.bind(on_release=self.painter.add_triangle)
		clear.bind(on_release=self.clear_canvas)

		# Make the canvas and the button children of the dummy widget
		parent.add_widget(self.painter)
		parent.add_widget(circle)
		parent.add_widget(rect)
		parent.add_widget(triangle)
		parent.add_widget(clear)

		return parent
예제 #39
0
 def build(self):
     parent = Widget()
     game = SnakeGame()
     Clock.schedule_interval(game.draw, 1 / 30)
     Clock.schedule_interval(game.update, 1 / 10)
     parent.add_widget(game)
     return parent
예제 #40
0
	def build(self):
		Window.bind(on_key_down=self.on_key_down)
		root = Widget()
		self.container = Container(ws_count=7)
		# here we add an instance of container to the window, ws_count shows number of workspaces we need
		root.add_widget(self.container)
		return root
예제 #41
0
	def build(self):
		root = Widget()

		# trying workspace idea
		workspace = Workspace()
		root.add_widget(workspace)

		return root
예제 #42
0
	def add_board(self):
		w = Widget(pos=(Window.width*0.45,0),size=(Window.width*0.5,Window.height*0.9))
		self.board = GestureBoard()
		self.board.pos=w.pos
		self.board.size=w.size
		self.board.bind(exists=self.update_text)
		w.add_widget(self.board)
		self.add_widget(w)
예제 #43
0
 def build(self):
     root = Widget()
     b1 = Button(pos=(0, 0),
                 # background_color=(226, 13, 13, 1),
                 size=(100, 50),
                 text="Click Me")
     root.add_widget(b1)
     return root
예제 #44
0
class FishLifeScore(Popup):
    def __init__(self):
        super(FishLifeScore, self).__init__()
        self.pos = (Window.width/2 - self.width/2, Window.height/2 - self.height/2)
        self.content = Widget(pos=self.pos, size=self.size)
        self.content.add_widget(self.score_table)
        self.content.add_widget(self.total_score)
        self.content.add_widget(self.restart_btn)
예제 #45
0
	def build(self):
		parent = Widget()
		self.image = ImageWidget()
		clearButton = Button(text='Clear')
		clearButton.bind(on_release=self.clear_canvas)
		parent.add_widget(self.image)
		parent.add_widget(clearButton)
		return parent
예제 #46
0
 def build(self):
     parent = Widget()
     clearbtn = Button(text='Clear')
     parent.add_widget(self.painter)
     parent.add_widget(clearbtn)
     
     clearbtn.bind(on_release=self.clearScreen)
     return parent
예제 #47
0
 def build(self):
     parent = Widget()
     self.painter = MyPaintWidget()
     clearbtn = Button(text='Clear')
     clearbtn.bind(on_release=self.clear_canvas)
     parent.add_widget(self.painter)
     parent.add_widget(clearbtn)
     return parent
예제 #48
0
 def build(self):
     Window.size = (1024, 768)
     main = Widget(center=Window.center)
     #p = ParticleEmitter1(20, 30, (0, 315), 20, 4, (1, 1, 1, 1), pos=main.center)
     p = ParticleEmitter2(10**10, 1, (6, 25), 10, (3, 20), (1, 1, 1, 1), pos=main.center)
     Clock.schedule_interval(p.tick, 1/30)
     main.add_widget(p)
     return main
예제 #49
0
파일: benchmark.py 프로젝트: 5y/kivy
 def __init__(self):
     root = Widget()
     for x in range(10):
         parent = Widget()
         for y in range(1000):
             parent.add_widget(Widget())
         root.add_widget(parent)
     self.root = root
예제 #50
0
파일: browser.py 프로젝트: rentouch/cefkivy
 def build(self):
     cb = CefBrowser(url="http://jegger.ch/datapool/app/test1.html",
                     keyboard_above_classes=["select2-input", ])
     w = Widget()
     w.add_widget(cb)
     #cb.pos = (100, 10)
     #cb.size = (1720, 480)
     return cb
예제 #51
0
 def build(self):
     parent = Widget()
     self.clearbtn = Button(text='Clear')
     self.painter = PainterBox(btn = self.clearbtn)
     self.clearbtn.bind(on_release=self.clear_canvas)
     self.clearbtn.disabled = True
     parent.add_widget(self.painter)
     parent.add_widget(self.clearbtn)
     return parent
예제 #52
0
파일: main.py 프로젝트: Ds110/kivy-studies
 def build(self):
     parent = Widget()
     self.painter = MyPaintWidget()
     clearbtn = ClearButton()
     colorbtn = ColorChangeButton()
     parent.add_widget(self.painter)
     parent.add_widget(colorbtn)
     parent.add_widget(clearbtn)
     return parent
예제 #53
0
    def build(self):
        root = Widget()
        puzzle = Puzzle(resolution=(640, 480), play=True)
        slider = Slider(min=100, max=200, step=10, size=(800, 50))
        slider.bind(value=partial(self.on_value, puzzle))

        root.add_widget(puzzle)
        root.add_widget(slider)
        return root
예제 #54
0
 def build(self):
   par = Widget()
   btn1 = Button(text='Hello world 1')
   btn1.bind(on_press=self.callback)
   btn2 = Button(text='Hello world 2')
   btn2.bind(on_press=self.callback)
   par.add_widget(btn1)
   par.add_widget(btn2)
   return par
예제 #55
0
파일: guiTest.py 프로젝트: alicenara/CAT
 def build(self):
     parent = Widget()
     self.main_screen = CatWidget()
     test_btn = Button(text='Test :D')
     test_btn.bind(on_press=self.button_pressed)
     test_btn.bind(on_release=self.do_tests)
     parent.add_widget(self.main_screen)
     parent.add_widget(test_btn)
     return parent
예제 #56
0
파일: main.py 프로젝트: mnzr/PyShapes
 def build(self):
     parent = Widget()
     # This part I don't understand
     self.board = DrawingBoard()
     # new button named Clear
     clearbtn = Button(text='Clear', font_size='30sp')
     clearbtn.bind(on_release=self.clear_canvas)
     parent.add_widget(self.board)
     parent.add_widget(clearbtn)
     return parent
예제 #57
0
          def build(self):
              camwidget = Widget()  #Create a camera Widget
              cam = Camera(play=True, index=1) #Start the camera
              camwidget.add_widget(cam)

              button=Button(text='screenshot', size_hint=(0.12, 0.12))
              button.bind(on_press=self.doscreenshot)
              camwidget.add_widget(button)    #Add button to Camera Widget
              cam.play=True
              return camwidget
예제 #58
0
파일: main.py 프로젝트: DanAlbert/kivy
 def show_scatters(self):
     col = Widget()
     center = self.content.center_x - 150, self.content.center_y
     s = KivyImageScatter(center=center)
     col.add_widget(s)
     center = self.content.center_x + 150, self.content.center_y
     s = ButtonsScatter(size=(300, 200))
     s.center = center
     col.add_widget(s)
     return col