示例#1
0
class HomePage(PageBase):
    """HomePage of the App.

    This is the first page that the user will see."""

    def __init__(self, app):
        """Constructor"""
        # Call the base.
        super(HomePage, self).__init__(app)

        # Load the backend
        self.backend = SpecialBackend(FlatfileBackend())

        # Create a body manually, overriding the default.
        self.body = AnchorLayout(anchor_x='center', anchor_y='center')
        stack_layout = StackLayout(size_hint=(0.95, 0.6))
        self.body.add_widget(stack_layout)

        text_layout =  BoxLayout(anchor_x='left', anchor_y='center', size_hint=(0.8, None))
        text_layout.height = '35px'
        stack_layout.add_widget(text_layout)

        def on_enter(sender):
            self._on_search(sender, self.query.text)
        self.query = TextInput(text='', multiline=False, hint_text='Type here...')
        self.query.bind(on_text_validate=on_enter)
        text_layout.add_widget(self.query)


        button_layout =  BoxLayout(anchor_x='right', anchor_y='center', size_hint=(0.2, None))
        button_layout.height = '35px'
        stack_layout.add_widget(button_layout)

        def on_search_press(sender):
            self._on_search(self.query, self.query.text)
        search = Button(text='Search!')
        search.width = '50px'
        search.bind(on_press=on_search_press)
        button_layout.add_widget(search)

        self.search_results = RichPage.get_page(app, [self], self.backend, 'search')

        def on_category_press(sender):
            RichPage.get_page(app, [self], self.backend, 'categories').show(self)
            self.hide()
        category = Button(text='Categories', size_hint=(None, None), height='35px')
        category.width = '100px'
        category.bind(on_press=on_category_press)        
        self.body.add_widget(category)

    def _on_search(self, sender, value):
        """Called when the user trys to search."""
        query = value
        self.query.text = ''

        self.backend.cached_search(query)
        self.search_results.reload()

        self.hide()
        self.search_results.show(self)
示例#2
0
    def build(self):
        self.root = NavigationDrawer()
        self.root.side_panel_opacity = 0
        self.root.separator_image_width = sp(0)
        menu = BoxLayout(orientation='vertical')

        resetButton = Factory.GreenButton(text='New Game')
        settingsButton = Factory.OrangeButton(text='Settings')
        helpButton = Factory.PurpleButton(text='Help')
        menu.add_widget(resetButton)
        menu.add_widget(settingsButton)
        menu.add_widget(helpButton)
        resetButton.bind(on_press=self.reset)

        self.root.add_widget(menu)

        content = AnchorLayout(anchor_x='right', anchor_y='bottom', paddind=sp(5))



        toggleButton = IconButton (icon="atlas://img/icon/iconatlas/icon-menu", size_hint=(.15, .1),
            background_normal='atlas://img/button/buttonatlas/red',
            background_down='atlas://img/button/buttonatlas/orange')
        toggleButton.bind(on_press=lambda j: self.root.toggle_state())

        content.add_widget(sm)
        content.add_widget(toggleButton)
        self.root.add_widget(content)
        sm.current = 'titleScreen'
        return self.root
示例#3
0
	def build(self):
		global root
		root = BoxLayout(orientation="vertical")
		
		#some art/whatsoever
		root.add_widget(Label(text="Whirl it Away"))
		
		#enable Facebook
		fb = Button(text="Login to Facebook")
		fb.bind(on_press = self.login_facebook)
		root.add_widget(fb)
		
		#enable Twitter
		twit = Button(text="Login to Twitter")
		twit.bind(on_press = self.login_twitter)
		root.add_widget(twit)
		
		login_button_area = AnchorLayout(anchor_x = 'right', anchor_y='bottom')
		login_button = Button(text="Let's go")
		login_button.bind(on_press = self.login)
		login_button_area.add_widget(login_button)
		
		
		root.add_widget(login_button_area)
		
		return root
示例#4
0
	def __init__(self, **kwargs):
		super(viewDayPopup, self).__init__(**kwargs)

		box = BoxLayout(orientation='vertical', spacing=10)
		get_input_box = BoxLayout(size_hint=(1, None), height=30)
		self.day_input = TextInput(multiline=False)
		self.month_input = TextInput(multiline=False)
		self.year_input = TextInput(multiline=False)
		day_lbl = Label(text='Ngày')
		month_lbl = Label(text='Tháng')
		year_lbl = Label(text='Năm')

		submit_btn = Button(text='OK', size_hint=(.2, 1), halign='center')
		anchor_submit_layout = AnchorLayout(anchor_x='center')
		anchor_submit_layout.add_widget(submit_btn)

		get_input_box.add_widget(day_lbl)
		get_input_box.add_widget(self.day_input)
		get_input_box.add_widget(month_lbl)
		get_input_box.add_widget(self.month_input)
		get_input_box.add_widget(year_lbl)
		get_input_box.add_widget(self.year_input)

		box.add_widget(get_input_box)
		box.add_widget(anchor_submit_layout)

		self.add_widget(box)
		self.day_input.focus = True
		self.day_input.bind(on_text_validate=self.dayValidate)
		self.month_input.bind(on_text_validate=self.monthValidate)
		self.year_input.bind(on_text_validate=self.yearValidate)
		submit_btn.bind(on_release=self.update)
示例#5
0
class MainScreen(Screen):
    buttons = {'main':['alarm']}
    settings = commonFunc.getYaml('settings')
    def __init__(self, **kwargs):
        self.bgImage = kwargs['background']
        super(MainScreen, self).__init__(**kwargs)
    def on_enter(self):
        grid = GridLayout()
        self.grid2 = AnchorLayout()
        self.bg = ImgButton(size=(800,480)) #CONFIG
        self.bg.source = self.bgImage.image()
        self.bg.bind(on_press=partial(app.change_view,'main'))
        self.grid2.add_widget(self.bg)
        for btn in self.buttons[self.name]:
            button = MainButton(text=btn,pos=getPos())
            button.bind(on_press=partial(app.change_view,btn,''))
            grid.add_widget(button)
        self.add_widget(self.grid2)
        self.add_widget(grid)
        Clock.schedule_interval(self.callback,self.settings['timeOut']) #CONFIG

    def on_leave(self):
        Clock.unschedule(self.callback)
        self.remove_widget(self.grid2)

    def callback(self,instalnce):
        self.bg.source=self.bgImage.nextImage()
示例#6
0
	def build(self):
		Builder.load_file('screens/login.kv')
		Builder.load_file('screens/home.kv')
		Builder.load_file('screens/scenarios.kv')
		Builder.load_file('main.kv')
		
		self.body.add_widget(Login(LoginMenu, 'loginmenu', None, name = 'login'))
		self.body.add_widget(Home(HomeMenu, 'homemenu', None, name = 'home'))
		self.body.add_widget(Scenarios(ScenariosMenu, 'scenariosmenu', 'home', name = 'scenarios'))
		self.body.add_widget(NewScenario(NewScenarioMenu, 'newscenariomenu', 'scenarios', name = 'newscenario'))
		self.body.current = 'login'
		
		self.menu.height = '48dp'
		self.menu.size_hint_y = None
		self.use_kivy_settings = False
		self.settings_cls = SettingsWithSidebar
		
		screen =  AnchorLayout(anchor_x='right', anchor_y='top')
		screen.add_widget(self.body)
		screen.add_widget(self.menu)
		
# 		screen = BoxLayout(orientation='vertical')
# 		screen.add_widget(self.menu)
# 		screen.add_widget(self.body)
				
		return screen
示例#7
0
    def add_meaning_empty(self, instance):

        """
        Add a meaning row on the GUI to let the user add his own meaning
        :param instance:
        :return:
        """
        self.grid_row.remove_widget(self.addmore)

        self.found_numb += 1
        self.counter += 1
        bl = BoxLayoutH50(id='bl'+str(self.found_numb))
        al = AnchorLayout(anchor_x='center', anchor_y='center', size_hint_x=0.05, size_hint_y=None, height=self.app.row_height)
        al.add_widget(IconButtonDel(id='btn'+str(self.found_numb), on_press=self.remove_line))
        bl.add_widget(al)
        bl.add_widget(TextInputH50(id='found'+str(self.found_numb), text='', size_hint_x=0.3))
        bl.add_widget(TextInputH50(id='url'+str(self.found_numb), text='', size_hint_x=0.3))
        bl.add_widget(CheckBoxH50(id='dis'+str(self.found_numb), size_hint_x=0.15))
        bl.add_widget(CheckBoxH50(id='approved'+str(self.found_numb), size_hint_x=0.1))
        if self.found_numb == 1:
            bl.add_widget(CheckBoxH50(id='chosen'+str(self.found_numb),
                                   group='chosen', size_hint_x=0.1, active=True))
        else:
            bl.add_widget(CheckBoxH50(id='chosen'+str(self.found_numb),
                                   group='chosen', size_hint_x=0.1))
        self.grid_row.add_widget(bl)
        self.grid_row.add_widget(self.addmore)
示例#8
0
 def handle_waitready(self, message):
     self.container.clear_widgets()
     btn = Label(label='En attente...', cls=['pentabtn', 'ready'],
             size=(200, 100))
     anchor = AnchorLayout(size=self.container.size)
     anchor.add_widget(btn)
     self.container.add_widget(anchor)
示例#9
0
文件: main.py 项目: oukiar/conquian
    def create_gui(self, w=None):
        
        #layout superior
        self.lay_up = AnchorLayout(anchor_x='center', 
                                    anchor_y='top',
                                    padding=5)

        self.nickname = ngTextInput(size_hint=(None,None), 
                                        size=(300,50), 
                                        pos=(500,100),
                                        text=self.nick)
        self.nickname.bind(on_enter=self.on_nickenter)
        self.lay_up.add_widget(self.nickname)

        self.add_widget(self.lay_up)
        
        #layout inferior derecha
        self.lay_rightbottom = AnchorLayout(anchor_x='right', 
                                    anchor_y='bottom',
                                    padding=0)
        
        self.txt_puntos = Label(text='Puntos: ',
                                        size_hint=(None,None), 
                                        size=(300,50))
        self.lay_rightbottom.add_widget(self.txt_puntos)
        
        self.add_widget(self.lay_rightbottom)
        
        #layoutprincipal, aqui va el chat y lo que vaya del otro lado que no sean las cartas
        self.lay_main = BoxLayout()
        self.add_widget(self.lay_main)
        
        #listbox con gente conectada
        self.people = ListBox(size_hint_x=.35, widget_cls=Button)
        self.lay_main.add_widget(self.people )
        
        #CREAR PARTIDA
        self.btn_crearpartida = Button(size_hint=(None,None), 
                                        size=(200,60), 
                                        text='Crear partida')
        self.btn_crearpartida.center = (Window.center[0], 70)
        self.btn_crearpartida.bind(on_press=self.on_crearpartida)
        self.lay_main.add_widget(self.btn_crearpartida)
        
        #JUGAR
        self.btn_jugar = Button(size_hint=(None,None), 
                                        size=(200,60), 
                                        text='Jugar')
        self.btn_jugar.center = (Window.center[0], 140)
        self.btn_jugar.bind(on_press=self.on_jugar)
        self.lay_main.add_widget(self.btn_jugar)
        
        #obtener la lista de dispositivos para jugar
        Request(action=self.server + '/conquian/get_devices.php', 
                    callback=self.on_devices, 
                    data=urllib.urlencode({'devID':self.devID})
                    )
        
        #crear tarjetas
        self.create_cards()
示例#10
0
    def set_list(self):
        #Get all image file name in Images Craft Bottles
        first_list = []
        second_list = []
        if self.query_result is None:
            i = 0
            for name in os.listdir('./images/bottles/'):
                if i%2 == 0:
                    first_list.append(name)
                else:
                    second_list.append(name)
                i = i + 1
            #get all Items
        else:
            i = 0
            for name in self.query_result:
                if i%2 == 0:
                    first_list.append(name+'.jpg')
                else:
                    second_list.append(name+'.jpg')
                i = i + 1
        # Clear widget first
        self.scroll_view_one.clear_widgets()
        self.scroll_view_two.clear_widgets()
        self.remove_widget(self.scroll_view_one)
        self.remove_widget(self.scroll_view_two)
        #First Horizontal Scrollable View
        grid_one_layout = GridLayout(cols=len(first_list), spacing=10, size_hint_x=None)
        #Make sure the height is such that there is something to scroll.
        grid_one_layout.bind(minimum_width=grid_one_layout.setter('width'))
        for file_name in first_list:
            anchor_one_layout = AnchorLayout(size_hint_x=None, size_hint_y=None, height=240, width=200, anchor_x='center', anchor_y='bottom')
            btn = Button(text=file_name, color=[0,0,0,0], size_hint_y=None, size_hint_x=None, height=240, width=200, background_color=[1,1,1,1], background_normal='images/bottles/{f_name}'.format(f_name=file_name))
            btn.bind(on_press=self.on_item_click)
            beer_name = file_name[:-4]
            label = Label(text=beer_name, color=[0,0,0,1], italic=True, font_size='12dp', size_hint=(None, None), height=30, width=anchor_one_layout.width, halign='center', pos_hint={'x':0,'y':0})
            anchor_one_layout.add_widget(btn)
            anchor_one_layout.add_widget(label)
            grid_one_layout.add_widget(anchor_one_layout)

        self.scroll_view_one.add_widget(grid_one_layout)
        self.add_widget(self.scroll_view_one)

        #First Horizontal Scrollable View
        grid_two_layout = GridLayout(cols=len(second_list), spacing=10, size_hint_x=None)
        #Make sure the height is such that there is something to scroll.
        grid_two_layout.bind(minimum_width=grid_two_layout.setter('width'))
        for file_name in second_list:
            anchor_two_layout = AnchorLayout(size_hint_x=None, size_hint_y=None, height=240, width=200, anchor_x='center', anchor_y='bottom')
            btn = Button(text=file_name, color=[0,0,0,0], size_hint_y=None, size_hint_x=None, height=240, width=200, background_color=[1,1,1,1], background_normal='images/bottles/{f_name}'.format(f_name=file_name))
            btn.bind(on_press=self.on_item_click)
            beer_name = file_name[:-4]
            label = Label(text=beer_name, color=[0,0,0,1], italic=True, font_size='12dp', size_hint=(None, None), height=30, width=anchor_two_layout.width, halign='center', pos_hint={'x':0,'y':0})
            anchor_two_layout.add_widget(btn)
            anchor_two_layout.add_widget(label)
            grid_two_layout.add_widget(anchor_two_layout)

        self.scroll_view_two.add_widget(grid_two_layout)
        self.add_widget(self.scroll_view_two)
示例#11
0
 def set_layout(self):
     
     #anchor_left = AnchorLayout(anchor_x='left', anchor_y='bottom')
     boxlayout1 = BoxLayout(orientation='horizontal', size_hint=(None, None), size=(Window.width, '%sdp' % self._height)) #, size=('350dp', 0))
     button_menu = Button(size_hint=(None, None), size=('127dp', '51dp'), border=(0, 0, 0, 0), 
                          background_normal='resources/interface/menu.png',
                          background_down='resources/interface/menu-pressed.png',
                          background_disabled_normal='resources/interface/menu.png',
                          background_color=(1, 1, 1, 1),
                          on_release=self.go_to_menu
                          )
     self.button_menu = button_menu
     #button_save = Button(size_hint=(None, None), size=('132dp', '57dp'), border=(0, 0, 0, 0),
     #                     background_normal='resources/interface/save.png',
     #                     background_down='resources/interface/save-pressed.png',
     #                     background_color=(1, 1, 1, 1))
     button_play = Button(size_hint=(None, None), size=('68dp', '51dp'), border=(0, 0, 0, 0),
                          background_normal='resources/interface/pause.png',
                          background_down='resources/interface/pause-pressed.png',
                          background_disabled_normal='resources/interface/pause.png',
                          on_release=GameContext.game.pause,
                          background_color=(1, 1, 1, 1))
     boxlayout1.add_widget(button_menu)
     #boxlayout1.add_widget(button_save)
     boxlayout1.add_widget(button_play)
     
     self.button_play = button_play
     self.button_play.set_paused = self.set_paused
     self.button_play.set_resumed = self.set_resumed
     
     #anchor_left.add_widget(boxlayout1)
     
     anchor_center = AnchorLayout(anchor_x='center', anchor_y="bottom", size_hint=(1, 1))
     #size=(Window.width, '%sdp' % self._height))
     steps = Label(text="STEPS:0", font_size="31dp", font_name=FONT_NAME) #, font_name="resources/Intro.ttf")
     self.steps = steps
     anchor_center.add_widget(steps)
     
     boxlayout1.add_widget(anchor_center)
     
     #anchor_right = AnchorLayout(anchor_x='right', anchor_y="bottom", size_hint=(None, None),
     #                             size=(Window.width, '%sdp' % self._height))
     boxlayout2 = BoxLayout(orientation='horizontal', size_hint=(None, 1), size=('120dp', 0))
     button_trees = Button(size_hint=(None, None), size=('68dp', '57dp'), border=(0, 0, 0, 0),
                          background_normal='resources/interface/trees.png',
                          background_down='resources/interface/trees.png',
                          background_disabled_normal='resources/interface/trees_press.png',
                          background_color=(1, 1, 1, 1),
                          on_release=GameContext.game.switch_to_plant_tree
                          )
     number_of_trees = Label(text='x5', font_size="31dp", font_name=FONT_NAME)
     boxlayout2.add_widget(button_trees)
     boxlayout2.add_widget(number_of_trees)
     
     self.button_trees = button_trees
     self.number_of_trees = number_of_trees
     
     boxlayout1.add_widget(boxlayout2)
     self.add_widget(boxlayout1)
示例#12
0
    def test_anchorlayout_default(self):
        from kivy.uix.anchorlayout import AnchorLayout
        r = self.render
        b = self.box

        layout = AnchorLayout()
        layout.add_widget(b(1, 0, 0))
        r(layout)
示例#13
0
 def _greeting(dt):
     
     anchor = AnchorLayout(anchor_x='center', anchor_y='center', size=(Window.width, Window.height))
     label = Label(text='TAP TO START', font_size='50dp', bold=True, font_name=FONT_NAME)
     anchor.add_widget(label)
     anchor.bind(on_touch_up=self.close_greeting)
     self.greeting_msg = anchor
     self.add_widget(self.greeting_msg)
示例#14
0
文件: main.py 项目: GunioRobot/kivy
 def show_accordion(self):
     root = Accordion()
     for x in xrange(5):
         item = AccordionItem(title='Title %d' % x)
         item.add_widget(Label(text='Very big content\n' * 10))
         root.add_widget(item)
     col = AnchorLayout()
     col.add_widget(root)
     return col
示例#15
0
文件: main.py 项目: gravyboat/andcat
    def create_and_add_widgets(self, screen_label=''):
        main_label = AndCatLabel(text='AndCat',
                                 size_hint=(1.0, None,),
                                 height=50)
        logo_container = AnchorLayout(anchor_x='right')
        logo_img = Image(source='logo.png', size_hint=(None, None,), width=50, height=50)

        logo_container.add_widget(logo_img)
        self.add_widget(main_label)
        self.add_widget(logo_container)
示例#16
0
文件: tttgame.py 项目: jpg75/TTT-kivy
    def __init__(self, *pars, **kpars):
        AnchorLayout.__init__(self, *pars, **kpars)
        self.cur_dir = dirname(abspath('file'))
        config = Configuration()
        config.purgelines()
        config.initialize()

        # do not use '-' or other chars in the name!
        self.username = ''

        self.turnables = config.getParam('turnable')
        self.cards_unturnable = bool(int(config.getParam('cards_unturnable')))

        # enables the automatic player agent, playing as NK as default. 
        self.rp = None  # Rule Parser
        self.auto_player = bool(int(config.getParam('auto_player')))
        if self.auto_player:
            self.rp = RuleParser()
            self.rp.load_rules()

        self.format = config.getParam('format')
        self.help_file = config.getParam('help_file')
        self.shoe_file = config.getParam('shoe_file')

        self.srv = config.getParam('server')
        self.srv_port = config.getParam('server_port')

        if self.format == 'circular':
            self.turnable = dict(zip(TTTGame.CIRCULAR_CARD_LAYOUT, [bool(int(x)) for x in self.turnables.split(',')]))
        else:
            self.turnable = dict(zip(TTTGame.LINEAR_CARD_LAYOUT, [bool(int(x)) for x in self.turnables.split(',')]))

        self.timer_start = int(config.getParam('timer_start'))

        # load default shoe_file:
        self.shoe_config = Configuration(config_file=self.shoe_file)
        self.shoe_config.purgelines()

        # self.turn = ''  # current player turn
        self.current_target_card = ''  # the target card stated in the shoe_file ("2H" usually)

        print self.shoe_config.content

        self.hands = []  # store all hands
        # file names are in the form: output-<dmY>-<HM>.txt
        # Here we just create a reference. The actual obj is made when the login popup is dismissed
        self.fout_handle = None
        self.fout_time_handle = None

        self.timeHistory = []  # list holding the strings: <move> <time>\n
        self.stopwatch = StopWatch()

        self.nk_history_q = deque([], 2)  # nk history of the last 2 hands. Required for automatic agent
        self.ck_history_q = deque([], 2)  # ck history of the last 2 hands. Required for automatic agent
示例#17
0
 def _retrieve_photo(self, *largs):
     ## Select and download the image
     photos = self.photos
     photo_count = len(photos)
     photo = photos[random.randint(0,photo_count-1)]
     title = self.title_cls(text=photo[u'title'], text_size=(200,None), id='title')
     img = self.image_cls(source=photo[u'media'][u'm'], id='img')
     layout = AnchorLayout(anchor_x='center', anchor_y='center')
     btn = ViewerButton(text='Flickr!')
     btn.bind(on_press=self._select_image)
     layout.add_widget(btn)
     return (img,title,layout)
示例#18
0
    def __init__(self, app, parent, title, **kw):
        logging.info('PysolAboutDialog:')
        super(PysolAboutDialog, self).__init__()

        self._url = kw['url']
        logging.info('PysolAboutDialog: txt=%s' % title)

        text = kw['text']
        text = text + '\n' + self._url
        logging.info('PysolAboutDialog: txt=%s' % text)

        text = text + '\n\n' + 'Adaptation to Kivy/Android\n' + \
            ' Copyright (C) (2016-17) LB'

        self.parent = parent
        self.app = app
        self.window = None
        self.running = False
        self.status = 1  # -> von help.py so benötigt
        self.button = 0  # -> von help.py so benötigt

        # bestehenden Dialog rezyklieren.

        logging.info('PysolAboutDialog: 1')
        onlyone = PysolAboutDialog.AboutDialog
        if (onlyone and onlyone.running):
            return
        if (onlyone):
            onlyone.parent.pushWork('AboutDialog', onlyone.window)
            onlyone.running = True
            return

        # neuen Dialog aufbauen.

        window = LTopLevel(parent, title, size_hint=(1.0, 1.0))
        window.titleline.bind(on_press=self.onClick)
        self.parent.pushWork('AboutDialog', window)
        self.window = window
        self.running = True
        PysolAboutDialog.AboutDialog = self

        if kw['image']:
            image = LImage(texture=kw['image'].texture)
            image.size_hint = (1, 0.8)
            al = AnchorLayout()
            al.add_widget(image)
            al.size_hint = (1, 0.3)
            window.content.add_widget(al)

        label = FText(text=text, halign='center', size_hint=(1, 1))
        window.content.add_widget(label)

        '''
示例#19
0
    def __init__(self, **kwargs):
        super(ProductDetailScreen, self).__init__(**kwargs)
        # File name of the beer selected
        # NEEDS TO BE SET
        #bottle_name = ('Coors_Lightbottle.jpg')
        # Beer name from the given bottle name
        #beer_name = re.sub('[^a-zA-Z0-9\n]', ' ', bottle_name)
        #beer_name = beer_name[:-4]
        # Beer text description pulled cfrom the given beer_name
        # NEEDS TO BE SET
        self.descriptionAnchor.add_widget(self.descriptionLabel)
        # self.info_layout.add_widget(self.nameLabel_two)
        # self.info_layout.add_widget(self.locationLabel)
        # self.info_layout.add_widget(self.priceLabel)

        self.info_layout.add_widget(self.descriptionAnchor)
        self.bottleImage_layout.add_widget(self.bottleImage)
        # Get all the tags for the given beer
        # NEEDS TO BE SET
        beer_tags = 'sports football stadium party coors molson light beer mountains'
        tag_list = []
        for i in beer_tags.split():
            tag_list.append(i)
        # Horizontal Scrollable View
        grid_one_layout = GridLayout(cols=30, spacing=5, size_hint_x=None)
        # Make sure the height is such that there is something to scroll.
        grid_one_layout.bind(minimum_width=grid_one_layout.setter('width'))
        for tag_name in tag_list:
            relative_one_layout = AnchorLayout(size_hint_x=None, size_hint_y=None, height=30, width=100)
            btn = Button(size_hint_y=None, size_hint_x=None, height=30, width=100, background_color=[1,1,1,1])
            label = Label(text=tag_name, color=[0,0,0,1], size_hint=(None, None), height=30, width=relative_one_layout.width, halign='center', pos_hint={'x':0,'y':0})
            relative_one_layout.add_widget(btn)
            relative_one_layout.add_widget(label)
            grid_one_layout.add_widget(relative_one_layout)

        scroll_view_one = ScrollView(bar_color=[0,0,0,0], size_hint=(1.0, None), height=30, pos_hint={'x':0.0,'y':0.0})
        scroll_view_one.do_scroll_y=False
        scroll_view_one.do_scroll_x=True
        scroll_view_one.add_widget(grid_one_layout)
        #self.add_widget(scroll_view_one)


        # Add wigets to the product detail page
        self.add_widget(self.logoImage)
        self.add_widget(self.bottleImage_layout)
        self.add_widget(self.nameLabel)

        self.add_widget(self.nameLabel_two)
        self.add_widget(self.locationLabel)
        self.add_widget(self.priceLabel)
        self.add_widget(self.info_layout)
示例#20
0
class CelticKnotwork(App):
    '''Main tabbed interface, each tab contains its own instance of CelticKnotwork2'''
    def build(self):
        ##Instance Variables
        self.showDots = True
        self.showGrid = True
        self.showBreaklines = True
        self.showSkeleton = True
        self.showKnot = True
        self.knotX = 4
        self.knotY = 4
        self.knotWidth = 8
        self.knotWidthView = 8
        self.gridUnits = 50
        self.gridUnitsView = 50
        self.offsetX = 150
        self.offsetY = 50
        self.totTabs = 1
        self.tabNo = 1
        
        
        ##Main Layout
        self.layout_main = AnchorLayout(anchor_x = "left", anchor_y="top")
        self.layout_tabs= FloatLayout(size=(Window.width, Window.height), size_hint=(0.1, 0.08))

        
        ##Top Tab Bar - allowing multiple knots
        self.tp = TabbedPanel()
        self.tp.default_tab_text = "Knot 1"
        self.layout_main.add_widget(self.tp)
        self.addTab = TabbedPanelHeader(text='+')
        self.addTab.bind(on_release = self.onPressAddTab)
        self.addTab = Button(text='+', pos =(Window.width*.9,Window.height*.92))
        self.addTab.bind(on_press = self.onPressAddTab)
        self.tp.default_tab_content = CelticKnotwork2().build() #get tab content from CelticKnotwork2
        self.layout_tabs.add_widget(self.addTab)
        self.layout_main.add_widget(self.layout_tabs)

        Window.bind(on_resize=self.on_resize)

        
        
        return self.layout_main
    def onPressAddTab(self, instance):
        '''Add a tab when "+" button pressed'''
        self.totTabs += 1
        self.tabNo = self.totTabs
        self.th = TabbedPanelHeader(text='Knot '+str(self.totTabs))
        self.th.content = CelticKnotwork2().build()
        self.tp.add_widget(self.th)
        
        self.tp.switch_to(self.th)
    def on_resize(self, window, height, somethingesle):
        '''Handles window resize'''
        self.layout_main.remove_widget(self.layout_tabs)
        self.layout_tabs= FloatLayout(size=(Window.width, Window.height), size_hint=(0.1, 0.05))
        self.addTab = Button(text='+', pos =(Window.width*.9,Window.height*.95))
        self.addTab.bind(on_press = self.onPressAddTab)
        self.layout_tabs.add_widget(self.addTab)
        self.layout_main.add_widget(self.layout_tabs)
示例#21
0
文件: main.py 项目: DanAlbert/kivy
 def show_popup(self):
     btnclose = Button(text='Close this popup', size_hint_y=None, height='50sp')
     content = BoxLayout(orientation='vertical')
     content.add_widget(Label(text='Hello world'))
     content.add_widget(btnclose)
     popup = Popup(content=content, title='Modal popup example',
                   size_hint=(None, None), size=('300dp', '300dp'))
     btnclose.bind(on_release=popup.dismiss)
     button = Button(text='Open popup', size_hint=(None, None),
                     size=('150sp', '70dp'),
                     on_release=popup.open)
     popup.open()
     col = AnchorLayout()
     col.add_widget(button)
     return col
示例#22
0
文件: main.py 项目: hartym/kivy
 def show_popup(self):
     btnclose = Button(text="Close this popup", size_hint_y=None, height=50)
     content = BoxLayout(orientation="vertical")
     content.add_widget(Label(text="Hello world"))
     content.add_widget(btnclose)
     popup = Popup(
         content=content, title="Modal popup example", size_hint=(None, None), size=(300, 300), auto_dismiss=False
     )
     btnclose.bind(on_release=popup.dismiss)
     button = Button(text="Open popup", size_hint=(None, None), size=(150, 70))
     button.bind(on_release=popup.open)
     popup.open()
     col = AnchorLayout()
     col.add_widget(button)
     return col
示例#23
0
文件: main.py 项目: Belxjander/Kirito
 def show_invalid_balance_popup(self):
     btnclose = Button(text='Close this popup', size_hint_y=None, height='50sp')
     content = BoxLayout(orientation='vertical')
     row_length = 15
     content.add_widget(Label(text='Not enough money for send.'))
     content.add_widget(btnclose)
     popup = Popup(content=content, title='Not enough...',
                   size_hint=(None, None), size=('300dp', '300dp'))
     btnclose.bind(on_release=popup.dismiss)
     button = Button(text='Open popup', size_hint=(None, None),
                     size=('150sp', '70dp'),
                     on_release=popup.open)
     popup.open()
     col = AnchorLayout()
     col.add_widget(button)
     return col
示例#24
0
    def __init__(self, **kwargs):
        """Set up the CardDisplays."""
        FloatLayout.__init__(self, **kwargs)
        self.main = BoxLayout(orientation="vertical", pos_hint={'x':0, 'y':0})
        self.slots = []
        for i in range(len(self.board)):  # for card in board iterates all sides
            layout = BoxLayout()
            side_slots = []
            for card in self.board[i]:
                display = CardDisplay(card=card)
                side_slots.append(display)
                layout.add_widget(display)
            self.slots.append(side_slots)
            self.main.add_widget(layout)
        self.add_widget(self.main)

        # Prep the next round prompt widget for later
        self._next_round_prompt = BoxLayout(size_hint=(1, .125))
        self._next_round_prompt.add_widget(Button(text="Replay",
                                           on_release=self.rescore_prompted))
        self._next_round_prompt.add_widget(Widget())  # spacer
        self._next_round_prompt.add_widget(Button(text="Continue",
                                           on_release=self.next_round_prompted))

        # Prep for powerup overlays
        self.powerup_anchor = AnchorLayout(anchor_x='right', anchor_y='top',
                                           size_hint=(1, 1),
                                           pos_hint={'x':0, 'y':0})
        self.add_widget(self.powerup_anchor)
    def __init__(self, image: Image, name: str, starter: AppStarter, height: int, **kwargs):
        super(AppLauncherIconWidget, self).__init__(**kwargs)

        self.__starter = starter

        self.cols = 1
        self.rows = 2

        self.rows_minimum[0] = height * 0.8
        self.rows_minimum[1] = height - self.rows_minimum[0]

        self.row_force_default = True

        self.__imageParent = AnchorLayout()
        self.__imageParent.anchor_x = 'center'
        self.__imageParent.anchor_y = 'center'

        self.__imageWidget = ImageWidget()
        self.__imageWidget.allow_stretch = True
        self.__imageWidget.keep_ratio = True
        self.__imageWidget.texture = image.texture

        self.__nameWidget = Label()
        self.__nameWidget.text = name
        self.__nameWidget.color = [0, 0, 0, 1]

        self.__imageParent.add_widget(self.__imageWidget)
        self.add_widget(self.__imageParent)
        self.add_widget(self.__nameWidget)
示例#26
0
 def on_enter(self):
     self.grid = AnchorLayout()
     self.img = ImgButton(size=(800,480)) #CONFIG
     self.img.source=self.bgImg.image()
     self.img.bind(on_press=partial(app.change_view,'main'))
     self.grid.add_widget(self.img)
     self.add_widget(self.grid)
     Clock.schedule_interval(self.callback,self.settings['imageDwel']) #CONFIG
示例#27
0
文件: main.py 项目: Belxjander/Kirito
 def show_copied_popup(self, address):
     btnclose = Button(text='Close this popup', size_hint_y=None, height='50sp')
     content = BoxLayout(orientation='vertical')
     row_length = 15
     for i in range(0, len(address), row_length):
         content.add_widget(Label(text=address[i:i + row_length]))
     content.add_widget(btnclose)
     popup = Popup(content=content, title='Copied Address',
                   size_hint=(None, None), size=('300dp', '300dp'))
     btnclose.bind(on_release=popup.dismiss)
     button = Button(text='Open popup', size_hint=(None, None),
                     size=('150sp', '70dp'),
                     on_release=popup.open)
     popup.open()
     col = AnchorLayout()
     col.add_widget(button)
     return col
示例#28
0
 def __init__(self, **kwargs):
     super(Calc_with_button, self).__init__(**kwargs)
     
     si = AnchorLayout(anchor_x='left', anchor_y='top')
     res = AnchorLayout(anchor_x='right', anchor_y='bottom')
     calc_but = AnchorLayout(anchor_x='center', anchor_y='bottom')
     
     si.add_widget(Stats_Input())
     res.add_widget(Results())
     calc_but.add_widget(Button(text='Calculate'))
     
     self.add_widget(si)
     self.add_widget(res)
     self.add_widget(calc_but)
示例#29
0
    def setTopImage(self, image, cw=0, ch=0):
        print('MfxCanvas: setTopImage %s' % image)

        if self.topImage:
            self.clear_widgets([self.topImage])
            self.topImage = None

        if image:
            tex = LImage(texture=image.texture)
            tex.size_hint = (0.4, 0.4)
            lay = AnchorLayout(anchor_y='bottom')
            lay.size = self.size
            lay.add_widget(tex)

            self.topImage = lay
            self.add_widget(self.topImage)

        return 1
    def test_anchor_layout_xy(self):
        from kivy.uix.anchorlayout import AnchorLayout
        r = self.render
        b = self.box

        layout = AnchorLayout(anchor_y='bottom', anchor_x='left')
        layout.add_widget(b(1, 0, 0))
        r(layout)

        layout = AnchorLayout(anchor_y='top', anchor_x='right')
        layout.add_widget(b(1, 0, 0))
        r(layout)
示例#31
0
 def show_popup(self):
     btnclose = Button(text='Close this popup', size_hint_y=None, height=50)
     content = BoxLayout(orientation='vertical')
     content.add_widget(Label(text='Hello world'))
     content.add_widget(btnclose)
     popup = Popup(content=content,
                   title='Modal popup example',
                   size_hint=(None, None),
                   size=(300, 300),
                   auto_dismiss=False)
     btnclose.bind(on_release=popup.dismiss)
     button = Button(text='Open popup',
                     size_hint=(None, None),
                     size=(150, 70))
     button.bind(on_release=popup.open)
     popup.open()
     col = AnchorLayout()
     col.add_widget(button)
     return col
示例#32
0
    def build2(self):
        controls = AnchorLayout(anchor_x='right', anchor_y='top', height=200)
        box = BoxLayout(size_hint_y=None, height=50)



        upc_l = Label(text='UPC:', font_size=40, size_hint_x=None, width=100,)
        entry = TextInput(font_size=40, size_hint_x=None, width=350)
        search_b = Button(text='Search', font_size=40, size_hint_x=None,
                          width=200, background_color=[0,1.7,0,1])


        controls.add_widget(box)
        box.add_widget(upc_l)
        box.add_widget(entry)
        box.add_widget(search_b)


        return controls
示例#33
0
文件: main.py 项目: ademokur/FaceFact
    def build(self):
        # Main Interface
        self.govde = BoxLayout()
        self._ImageSide = AnchorLayout()
        self._infoSide = AnchorLayout()
        self.buttons = NextWindow()

        #Buttons
        self.iter = 0
        self.person = PersonInfo(image_path="__path")

        #Inferface of People
        self.govde.add_widget(self._ImageSide)
        self.govde.add_widget(self._infoSide)

        self._infoSide.add_widget(self.person)
        self._infoSide.add_widget(self.buttons)

        return self.govde
示例#34
0
    def __init__(self, **kwargs):
        super(IntroLogo, self).__init__(**kwargs)

        self.layout = AnchorLayout(padding=[100])
        self.add_widget(self.layout)

        # Add starting Logo
        self.logo = Image(source='WHO.png',
                          allow_stretch=True,
                          keep_ratio=True)
        self.layout.add_widget(self.logo)

        # Specific function that removes a KeyboardsListener and then switches to next screen
        def switch():
            keyboard.remove_hotkey(self.hotkey)
            sm.switch_to(VideoScreen())

        # Add custom KeyBoardListener that triggers the switch-function on enter-key
        self.hotkey = keyboard.add_hotkey('enter', switch)
示例#35
0
    def __init__(self, title, text, time=None, linesNumber=None):
        super(Alert, self).__init__()
        content = AnchorLayout(anchor_x='center', anchor_y='bottom')
        content.add_widget(Label(text=text, halign='left', valign='top'))

        if linesNumber == None:
            linesNumber = 1

        popup = Popup(
            title=title,
            content=content,
            size_hint=(max(len(title), len(text)) * 0.012, 0.2 * linesNumber),
            auto_dismiss=True,
        )
        popup.open()
        if time == None:
            Clock.schedule_once(popup.dismiss, 1.7)
        else:
            Clock.schedule_once(popup.dismiss, time)
 def __init__(self, **kwargs):
     super(ContentNavigationDrawer, self).__init__(**kwargs)
     ###############################
     self.orientation = 'vertical'
     self.padding = '8dp'
     self.spacing = '8dp'
     ###############################
     self.Anchor1 = AnchorLayout()
     self.Label1 = MDLabel()
     self.LSpace = MDLabel()
     self.Label2 = MDLabel()
     self.Label3 = MDLabel()
     self.Label4 = MDLabel()
     self.Label5 = MDLabel()
     self.Label6 = MDLabel()
     self.Scrll = ScrollView()
     self.Pic1 = Image(source='icon.png')
     ###############################
     return
示例#37
0
    def __init__(self, **kwargs):
        super(MyBackground, self).__init__(**kwargs)
        with self.canvas:
            self.bg = Rectangle(source='logi.png',
                                pos=self.pos,
                                size=self.size)

        self.bind(pos=self.update_bg)
        self.bind(size=self.update_bg)
        self.layout = AnchorLayout(anchor_x='left', anchor_y='center')
示例#38
0
    def build(self):
        rclpy.init()
        self.node = PathfinderGuiNode()

        self.buildMoveBtn()
        # self.buildRotBtn()
        self.buildChooseRobotDropdown()

        midBox = BoxLayout(orientation='vertical',
                           spacing=20,
                           size_hint_y=None)
        midBox.add_widget(self.box_dropdown)
        midBox.add_widget(self.box)
        # midBox.add_widget(self.box_rot)

        topBox = AnchorLayout(anchor_x='center', anchor_y='center')
        topBox.add_widget(midBox)

        return topBox
示例#39
0
class SettingSwitchItem(AnchorLayout):
    """
    Holds a Label and MDSwitch which controls whether or not some setting is on.
    """

    def __init__(self, display_text, config_handler, setting_key, **kwargs):
        """
        Creates an SettingSwitchItem object
        :param kwargs: Arguments for Anchor Layout
        """
        super(SettingSwitchItem, self).__init__(**kwargs)

        self.config_handler = config_handler

        self.text_anchor_layout = AnchorLayout(anchor_x="left", anchor_y="top")
        self.text_anchor_layout.add_widget(
            Label(
                text=display_text,
                color=DARK_THEME_TEXT_COLOR
                if self.config_handler.get_setting(CONFIG_ENABLE_DARK_MODE_KEY)
                else LIGHT_THEME_TEXT_COLOR,
                font_name="RobotoMono-Regular",
                size_hint=(1, 0.5),
                font_size="10sp",
            )
        )

        self.setting_key = setting_key

        self.dark_mode_checkbox = MDSwitch(
            active=config_handler.get_setting(setting_key)
        )
        self.dark_mode_checkbox.bind(active=self.update_setting)
        self.dark_mode_checkbox_anchor_layout = AnchorLayout(
            anchor_x="center", anchor_y="bottom"
        )
        self.dark_mode_checkbox_anchor_layout.add_widget(self.dark_mode_checkbox)

        self.add_widget(self.text_anchor_layout)
        self.add_widget(self.dark_mode_checkbox_anchor_layout)

    def update_setting(self, checkbox, value):
        self.config_handler.update_settings(self.setting_key, value)
示例#40
0
class Contacti(App):
    def build(self):
        self.anx = AnchorLayout()

        self.osn = Image(source='Fonn.jpg')
        self.anx.add_widget(self.osn)
        self.bl = BoxLayout(orientation='vertical',
                            padding=[15, 10],
                            spacing=5,
                            size_hint=(.5, .5))

        self.bl.add_widget(
            Label(text="Упраление акаунтом",
                  font_size='50sp',
                  size_hint=(1, 1),
                  valign="center"))  # назв

        self.txima = TextInput(hint_text="Ваш email:", height=60)
        self.txema = TextInput(hint_text="Пароль:", height=60)
        self.btn = Button(text="Сохранить",
                          font_size='30sp',
                          on_press=self.soxronpar,
                          background_color=[0.2, .8, 0.3, 1],
                          background_normal='')

        self.bl.add_widget(self.txima)
        self.bl.add_widget(self.txema)
        self.bl.add_widget(self.btn)

        self.anx.add_widget(self.bl)

        return self.anx

    def soxronpar(self, instance):
        #f = open('dobav.txt', 'w')
        if self.txima.text != "" and self.txema.text != "" and "@" in self.txima.text and "." in self.txima.text:
            f = open('dobav.txt', 'w')
            f.write(self.txima.text + "\n")
            f.write(self.txema.text + "\n")
            self.txima.text = ""
            self.txema.text = ""
            self.btn.text = "Сохранено"
            f.close()
示例#41
0
    def generic(self):

        num_screens = 16
        inches = kivy.metrics.inch(1.55)
        self.small_btn_size = inches/2
        print inches
    
        for i in range(1,9,1):

            scatter1 = Scatter(do_translation = False, do_scale = False, do_rotation = False, 
                size = (inches,inches*2), pos=((self.width2 *.1) + (i*inches), self.width2/6), size_hint = (None, None))
            bx = BoxLayout(size = scatter1.size, orientation = 'vertical')
            scatter1.add_widget(bx)

            tokenb = Button(size= (inches,inches), size_hint = (None, None), text = "token: " + str(i))
            anchor = AnchorLayout(anchor_x='center', anchor_y='bottom')

            option = selectButton((inches/2),  str(i))
            anchor.add_widget(option)

            bx.add_widget(tokenb)
            bx.add_widget(anchor)

            self.add_widget(scatter1)

            self.hitPoints.append(option)

        for i in range(9,17,1):

            scatter1 = Scatter(do_translation = False, do_scale = False, do_rotation = False, 
                size = (inches,inches*2), pos=((self.width2 *.1) + ((i-8)*inches), self.width2/2), size_hint = (None, None))
            bx = abc(scatter1.size, str(i))
            scatter1.add_widget(bx)

            with bx.canvas.before:

                Color(H.rgb(200), H.rgb(22), H.rgb(0), 1)  # green; colors range from 0-1 instead of 0-255
                self.rect2 = Rectangle(size=bx.size, pos=bx.pos)

            tokenb = Button(size= (inches,inches), size_hint = (None, None), text = "token: " + str(i))

            anchor = AnchorLayout(anchor_x='center', anchor_y='bottom')

            option = selectButton((inches/2),  str(i))
            anchor.add_widget(option)

            bx.add_widget(tokenb)
            bx.add_widget(anchor)

            self.add_widget(scatter1)

            self.hitPoints.append(option)
示例#42
0
    def build(self):
        self.soubor = SOUBOR
        Window.clearcolor = (255, 255, 255, 255)

        layoutLabel = GridLayout(cols=1,row_force_default = True, row_default_height = 100)
        layoutText = GridLayout(cols=1 ,row_force_default = True, row_default_height = 950)
        layoutCenter = AnchorLayout(anchor_x='center', anchor_y='center')
        layoutCenter2 = AnchorLayout(anchor_x='center', anchor_y='bottom')
        layout = FloatLayout()

        lab = Label(text="Welcome to the game! CROSSWORD",
                    font_size = '45sp',
                    color=(0,0,0)
                    )
        labInfo = Label(text="(Optional) Choose file to make crossword from:",
                    font_size = '20sp',
                    color=(0,0,0)
                    )


        btn = Button(text="Start",
                     font_size='20',
                     color=(0, 0, 0),
                     size_hint = (.4, .1),
                     width = 200,
                     height=100
                     )

        btnChoose = Button(text=NAZEV_SOUBORU,
                     font_size='20',
                     color=(0, 0, 0),
                        size_hint_y= None,
                     width = 200,
                     height=100

                     )

        btn.bind(on_press=self.turnOn)
        btnChoose.bind(on_press=self.chooseFile)

#//////////////////////////////////////////////////////////
        layoutLabel.add_widget(lab)
        layoutCenter2.add_widget(btnChoose)
        layoutCenter.add_widget(btn)
        layoutText.add_widget(labInfo)
        layout.add_widget(layoutCenter)
        layout.add_widget(layoutLabel)
        layout.add_widget(layoutCenter2)
        layout.add_widget(layoutText)
#//////////////////////////////////////////////////////////

        return layout
示例#43
0
    def btnPress(self, *args):
        self.settings.counter += 1
        # всплывает попап с отмазкой
        excuse = self.excuses[randint(0, len(self.excuses) - 1)]
        # textLabel = Label(text=markup_text(size=80, color='000000', text=exсuse, bold=False), markup=True, size_hint=(0.8, 0.8), valign='top')
        # textLabel.bind(size=textLabel.setter('text_size'))
        # popup = ModalView(title="ОТМАЗКА НА СЕГОДНЯ",
        #               title_color=(0x75 / 255.0, 0x86 / 255.0, 0x8F / 255.0, 1),  # 75868F
        #               title_size=46 / divider,
        #               #background='white',
        #               background_color=(1, 1, 1, 0),
        #               separator_color=(1, 1, 1, 1),
        #               content=textLabel,
        #               size_hint=(.7, .5))

        popup = ModalView(size_hint=[0.8, 0.6])
        effectWidget = EffectWidget(size_hint=[1.2, 1.2])
        effectLayout = AnchorLayout(anchor_x='center', anchor_y='center', size_hint=[1, 1])
        popupWidget = RoundedWidget(size_hint=[0.9, 0.9], background_color=(1, 1, 1, 1), shadow_color=(70, 70, 70, 1))
        widgetLayout = BoxLayout(orientation='vertical')

        def popupUpdate(instance, *args):
            x, y = instance.size
            widgetLayout.size = (x - 100, y - 100)
            w, h = instance.pos
            widgetLayout.pos = (w + 50, h + 50)

        popupWidget.bind(size=popupUpdate, pos=popupUpdate)  # popupButton.setter('text_size'))
        captionLabel = Label(text=markup_text(size=46, color='75868F', text='ОТМАЗКА НА СЕГОДНЯ', font='Roboto-Black'), markup=True, size_hint=(1, 0.35), valign='top', halign='left')
        captionLabel.bind(size=captionLabel.setter('text_size'))
        textLabel = Button(text=markup_text(size=80, color='000000', text=excuse, bold=False), markup=True, size_hint=(1, 0.65), valign='top', halign='left', background_color=(0, 0, 0, 0), on_press=popup.dismiss)
        textLabel.bind(size=textLabel.setter('text_size'))
        widgetLayout.add_widget(captionLabel)
        widgetLayout.add_widget(textLabel)
        popupWidget.add_widget(widgetLayout)
        effectLayout.add_widget(popupWidget)
        effectWidget.add_widget(effectLayout)
        effectWidget.effects = [DropShadowEffect(radius=SHADOW_RADIUS / divider, tint=[0, 0, 0, 0.7])]
        popup.add_widget(effectWidget)
        popup.background_color = (0.2, 0.2, 0.2, 0.6)

        popup.open()
    def add_input(self):
        num_input = self.ids.DigitInput.text
        self.ids.DigitInput.text = ''
        Clock.schedule_once(self.focus_set, 0.2)
        try: 
            num_input = int(num_input)
        except ValueError:
            self.popup_error_inputfield()
            return
        try: 
            self.input_list.append(num_input)
            label_text = (str(num_input))
            output_label = ScaleLabel(text=label_text, size_hint= [0.8, .5], pos_hint={'right':0.91, 'top':.79}, font_size=50)

            layout_wrapper = AnchorLayout(anchor_x = 'center', anchor_y = 'center')
            layout_wrapper.add_widget(output_label)
            self.prev_input_label_list = layout_wrapper
            self.ids.InputGrid.add_widget(layout_wrapper)
        except ValueError:
            print('Throwing down the gauntlet!!!!>_< (an error needs to be inserted)')
示例#45
0
    def build(self):
        Window.size = (300, 50)

        layout1 = AnchorLayout(anchor_x='left', anchor_y='center')
        layout = BoxLayout(orientation="horizontal",
                           size_hint=(1, None),
                           height=30)

        but = Button(text="join", size_hint=(.2, None), height=30)
        global txtin
        layout.add_widget(txtin)
        layout.add_widget(but)

        but.bind(on_press=self.click2)

        txtin.bind(on_text_validate=self.on_en)

        layout1.add_widget(layout)

        return layout1
示例#46
0
 def build(self):
     b = BoxLayout(orientation ='vertical') 
     # Adding the text input 
     text = TextInput(font_size = 30, 
                   size_hint_y = None, 
                   height = 70) 
     f = FloatLayout() 
     s = Scatter() 
     l = Label(text ="Hello !", 
               font_size = 50) 
     b.add_widget(self.send())
     btnlayout = AnchorLayout(
         
         anchor_y = 'bottom',
         
     )
     text.bind(text = l.setter('text')) 
     btnlayout.add_widget(text)
     b.add_widget(btnlayout)
     return b
示例#47
0
 def create(self):
     anchor_layout = AnchorLayout(size_hint=(1, None),
                                  height=dp(85),
                                  anchor_x='right',
                                  anchor_y='center',
                                  padding=(dp(35), dp(35), dp(35),
                                           dp(0)))
     header = Label(size_hint=(1, None),
                    height=dp(50),
                    halign='left',
                    valign='center',
                    font_size=sp(40),
                    color=get_color_from_hex('#150470'),
                    text='[font=assets/Inter-SemiBold.ttf]Home',
                    markup=True)
     header.bind(size=header.setter('text_size'))
     border = self.Border(size_hint=(None, None), size=(dp(50), dp(50)))
     border.bind(pos=border.pos_callback)
     anchor_layout.add_widget(header)
     anchor_layout.add_widget(border)
     return anchor_layout
示例#48
0
    def __init__(self, kaliteApp):
        dropdown = DropDown()
        dropdown_btn = Button(text='menu',
                              size_hint_x=None,
                              size_hint_y=None,
                              size=(150, 40),
                              font_size=18,
                              color=(.06, .6, .2, 1),
                              bold=True,
                              background_color=(1, 1, 1, 0.2))
        dropdown_btn.bind(on_release=dropdown.open)

        self.root_layout = GridLayout(cols=1)
        logo_holder = _BoxLayout(orientation='horizontal')
        logo_img = Image(source='horizontal-logo.png',
                         size_hint_x=None,
                         width=360)

        logo_holder.padding = [10, 10, 10, 10]
        logo_holder.add_widget(logo_img)

        self.content_reload_btn = Button(text='Reload Content',
                                         size_hint_x=None,
                                         size_hint_y=None,
                                         size=(150, 40),
                                         font_size=18,
                                         color=(1, 1, 1, 1),
                                         bold=True)

        self.content_reload_btn.bind(on_press=kaliteApp.reload_content)
        space_holder = _BoxLayout(orientation='horizontal', pos_hint={'x': .8})
        logo_holder.add_widget(space_holder)

        buttons_holder = AnchorLayout(anchor_x='center', anchor_y='center')

        dropdown.add_widget(self.content_reload_btn)
        logo_holder.add_widget(dropdown_btn)
        logo_holder.spacing = [300, 0]
        self.root_layout.add_widget(logo_holder)

        self.img_holder = BoxLayout(orientation='vertical',
                                    size=(200, 200),
                                    size_hint=(1, None))
        self.img_holder.padding = [0, 80, 0, 10]
        self.root_layout.add_widget(self.img_holder)

        self.progress_bar = ProgressBar()

        self.messages = BoxLayout(orientation='vertical')

        self.root_layout.add_widget(self.messages)
        self.root_layout.add_widget(buttons_holder)
        self.root_layout.add_widget(self.progress_bar)
示例#49
0
    def load_views(self):
        # custom widgets
        self.backdrop = self.get_widget('backdrop')
        self.top_left = self.get_widget('top-left')
        self.top_right = self.get_widget('top-right')
        self.bottom_left = self.get_widget('bottom-left')
        self.bottom_right = self.get_widget('bottom-right')
        self.clock = self.get_widget('clock')

        self.add_widget(self.backdrop)
        self.add_widget(self.clock)
        self.add_widget(self.top_left)
        self.add_widget(self.top_right)
        self.add_widget(self.bottom_right)
        self.add_widget(self.bottom_left)

        # greeting info label
        self.top_center = AnchorLayout(anchor_x='center', anchor_y='top')
        self.greeting_label = Label(size_hint=(None, None), font_size=30)
        self.top_center.add_widget(self.greeting_label)
        self.add_widget(self.top_center)
示例#50
0
 def show_invalid_balance_popup(self):
     btnclose = Button(text='Close this popup',
                       size_hint_y=None,
                       height='50sp')
     content = BoxLayout(orientation='vertical')
     row_length = 15
     content.add_widget(Label(text='Not enough money for send.'))
     content.add_widget(btnclose)
     popup = Popup(content=content,
                   title='Not enough...',
                   size_hint=(None, None),
                   size=('300dp', '300dp'))
     btnclose.bind(on_release=popup.dismiss)
     button = Button(text='Open popup',
                     size_hint=(None, None),
                     size=('150sp', '70dp'),
                     on_release=popup.open)
     popup.open()
     col = AnchorLayout()
     col.add_widget(button)
     return col
示例#51
0
    def build(self):

        layout = GridLayout(cols=2)
        layout.add_widget(Label(text='Mass'))
        self.Mass = TextInput(multiline=False)
        layout.add_widget(self.Mass)
        layout.add_widget(Label(text='Depth'))
        self.Depth = TextInput(multiline=False)
        layout.add_widget(self.Depth)
        layout.add_widget(Label(text='Width'))
        self.hWidth = TextInput(multiline=False)
        layout.add_widget(self.hWidth)
        self.popup = Popup(title='Test popup')
        GoBtn = Button(text='GO!')
        GoBtn.bind(on_release=self.main)
        layout.add_widget(GoBtn)
        anchor = AnchorLayout(anchor_x='center', anchor_y='bottom')
        btn = Button(text=('test'))
        anchor.add_widget(btn)

        return layout
示例#52
0
    def build(self):
        layout = Home()

        self.lbl1 = Label(text="test")
        layout.add_widget(self.lbl1)
        self.txt1 = TextInput(font_size=30, size_hint_y=None, height=70)

        btn1 = self.send()

        btnlayout = AnchorLayout(anchor_y='bottom', )
        typeandsend = BoxLayout(
            orientation='horizontal',
            spacing=2,
        )

        typeandsend.add_widget(self.txt1)
        typeandsend.add_widget(btn1)
        btnlayout.add_widget(typeandsend)
        layout.add_widget(btnlayout)

        return layout
示例#53
0
            def __init__(self, **kwargs):
                super(Container, self).__init__(**kwargs)

                anchor_rb = AnchorLayout(anchor_x='right', anchor_y='bottom')
                btn = Button(text='Hello World',
                             size=(100, 100),
                             size_hint=(None, None))
                image = Image(
                    source=
                    'https://upload.wikimedia.org/wikipedia/commons/thumb/0/05/20100726_Kalamitsi_Beach_Ionian_Sea_Lefkada_island_Greece.jpg/1920px-20100726_Kalamitsi_Beach_Ionian_Sea_Lefkada_island_Greece.jpg'
                )
                anchor_rb.add_widget(btn)
                anchor_rb.add_widget(image)
                self.add_widget(anchor_rb)

                anchor_lc = AnchorLayout(anchor_x='left', anchor_y='center')
                lbl = Label(text="Am i a Label ?",
                            size=(100, 100),
                            size_hint=(None, None))
                anchor_lc.add_widget(lbl)
                self.add_widget(anchor_lc)
示例#54
0
文件: qq.py 项目: SerMaks/python2
 def build(self):
     Al = AnchorLayout()
     bl = BoxLayout(orientation='vertical', padding=[200], spacing=15)
     bl.add_widget(
         Button(
             text="Меня зовут",
             font_size=14,
             on_press=self.btn_press,
             background_color=[1, 0, 1, 1],
             background_normal='',
         ))
     bl.add_widget(
         Button(
             text="Илья Ушаков",
             font_size=14,
             on_press=self.btn_press2,
             background_color=[0, 1, 1, 1],
             background_normal='',
         ))
     Al.add_widget(bl)
     return Al
示例#55
0
    def timer_setup(self, event):
        popup2 = Popup(title = "Interval time:")
        grid_layout = GridLayout(cols=2) #When the timer button is clicked, a timer popup appears whcih allows the user to choose a time
        anchor = AnchorLayout(anchor_x = 'center', anchor_y='bottom') #The Anchor layout is used here as it is easier for the user to see what thye need to do and where
        input_time = Label(text="Please input the time you \nwould like to set a timer for: ", font_size=20,) #This is a label that allows the user to chosse what time thye want
        dropdown = DropDown() #The user chooses the time they want througha  dropdown menu openedup
        for minutes in range(19): #The user will have 20 choises of intervals of 5 minutes for their timer
            btn = Button(text=(str(int(minutes+1)*5)), size_hint_y=None, height = 44) #This creates a button with the title of 5 minute intervals for every single selections choice
            btn.bind(on_release = lambda btn: dropdown.select(btn.text)) #This binds each button to the original button with the text "Minutes" so that the dropdown effect occurs when that button is clicked
            dropdown.add_widget(btn) #This adds the btn to the dropdown effect menu
        mainbutton = Button(text="Minutes", size_hint_y=None) #This is the original button that will use the dropdown effect when clicked
        mainbutton.bind(on_release = dropdown.open) #This dropdown effect is what happens when the button is released (i.e it opens the dropdown)
        dropdown.bind(on_select = lambda instance, x: setattr(mainbutton, 'text', x)) #The users selection of time is then set as the buttons text
        dropdown.bind(on_select = self.timeset) #The button also runs the timeset function when selected
        dropdown.bind(on_dismiss = popup2.dismiss) #When the button is pressed the poopup is closed

        anchor.add_widget(mainbutton) #This adds the buttons to the anchor layout
        grid_layout.add_widget(input_time)
        grid_layout.add_widget(anchor)
        popup2.content = grid_layout
        popup2.open()
示例#56
0
    def __init__(self, info, manager, **kwargs):
        super().__init__(**kwargs)
        self.info = info
        self.manager = manager
        self.elevation = 10

        box_container = BoxLayout()
        title = MDLabel(text=info[1],
                        font_style="H6",
                        halign="center",
                        font_size=9)
        distance = MDLabel(
            text=str(info[15]) + " Miles",
            font_style="H6",
            halign="center",
            font_size=9,
        )
        box_container.add_widget(title)
        box_container.add_widget(distance)

        background_button = Button(background_color=[0, 0, 0, 0],
                                   on_release=self.enter_info_screen)

        anchor = AnchorLayout()
        anchor.add_widget(background_button)
        anchor.add_widget(box_container)

        self.add_widget(anchor)
示例#57
0
    def details(self, pos, size):
        anchor_layout = AnchorLayout(pos=pos,
                                     size=size,
                                     anchor_x='center',
                                     anchor_y='center')
        pet = Label(
            padding=(dp(15), dp(15)),
            size_hint=(1, 1),
            halign='left',
            valign='top',
            markup=True,
            text='[color=150470][size=' + str(int(dp(20))) +
            '][font=assets/Inter-SemiBold.ttf]' + self._name[0] + '\n[size=' +
            str(int(dp(18))) + '][font=assets/Inter-Medium.ttf]' +
            self._gender[0] + '\n[size=' + str(int(dp(16))) +
            '][font=assets/Inter-Regular.ttf]' + self._date.split(':')[0])
        pet.bind(size=pet.setter('text_size'))
        time = Label(padding=(dp(15), dp(15)),
                     halign='right',
                     valign='bottom',
                     markup=True,
                     text='[color=150470][size=' + str(int(dp(18))) +
                     '][font=assets/Feather.ttf]юд▓[size=' + str(int(dp(18))) +
                     '][font=assets/Inter-Medium.ttf] 5 Hours Ago')
        time.bind(size=time.setter('text_size'))
        anchor_layout.add_widget(pet)
        anchor_layout.add_widget(time)

        return anchor_layout
示例#58
0
    def __init__(self, app, **kwargs):
        super().__init__(**kwargs)
        self.app = app

        self.orientation = "horizontal"
        self.padding = (5, 0)
        self.adaptive_height = True

        self.label = MDLabel()
        self.label.halign = "center"
        self.add_widget(self.label)

        self.check1 = Check(self.update_value1)
        self.add_widget(self.check1)

        self.check2 = Check(self.update_value2)
        self.check2.size = ("36dp", "36dp")
        checkAnchor = AnchorLayout()
        checkAnchor.add_widget(self.check2)
        checkAnchor.anchor_x = "center"
        self.add_widget(checkAnchor)
        checkAnchor.size_hint_x = 0.2

        self.check3 = Check(self.update_value3)
        self.add_widget(self.check3)

        self.bind(text=self.update_text)
示例#59
0
    def __init__(self, **kwargs):
        super(WelcomeUI, self).__init__(**kwargs)
        self.cols = 1
        
        self.welcome = AnchorLayout(anchor_x='center',
                                    anchor_y='top')
        self.welcome.add_widget(Label(text='Welcome back!',
                              font_size = 40))
        
        current_time = datetime.datetime.today()
        current_time = current_time.strftime('\n%B %d, %Y \n%H:%M:%S')

        self.time = AnchorLayout(anchor_x='center',
                                 anchor_y='center')
        self.time.add_widget(Label(text='Today\'s date and time is: {}'.format(
            current_time)))

        self.press = AnchorLayout(anchor_x='center',
                                  anchor_y='bottom')
        self.go = Button(text='Continue',
                         size_hint = (0.2, 0.2))
        self.press.add_widget(self.go)

        self.add_widget(self.welcome)
        self.add_widget(self.time)
        self.add_widget(self.press)
示例#60
0
    def __init__(self, **kw):
        """ SET UP LAYOUT """
        super().__init__(**kw)
        buttons = {
            "Extract chromosomes": 0.2,
            "Back": 0.2,
            "empty space": 0.4,
            "Restart": 0.2
        }

        on_presses = {
            "Extract chromosomes": self.start_extracting_chromosomes,
            "Back": self.go_to_raw_karyotyping_screen,
            "empty space": None,
            "Restart": self.go_to_raw_karyotyping_screen
        }

        self.button_layout = ButtonLayout(buttons,
                                          on_presses,
                                          size_hint=(0.15, 1.0))

        self.image_layout = AnchorLayout(size_hint=(0.85, 1.0))
        self.image = ZoomableImage(source="")
        self.image_layout.add_widget(self.image)

        self.layout = BoxLayout(orientation='horizontal', spacing=10)
        self.layout.add_widget(self.image_layout)
        self.layout.add_widget(self.button_layout)

        self.add_widget(self.layout)
        """ Set up properties """
        self.name = "generate_chromosome_cluster_screen"
        self.image_dir_in = data_dir + "/generate_chromosome_cluster"
        self.image_dir_out = data_dir + "/extract_chromosomes"
        self.previous_screen = None
        self.input = None
        self.output = {
            "chromosomes": None,
        }