Пример #1
0
    def build(self):
        layout_main = BoxLayout(
            orientation='vertical',

        )
        text_input = TextInput(
            font_size=150,
            height=200,
            size_hint_y=None,
            text='default',
        )

        layout = FloatLayout()
        scatter = Scatter()
        label = Label(
            text="default",
            font_size=150,
        )

        text_input.bind(text=label.setter('text'))

        layout.add_widget(scatter)
        scatter.add_widget(label)

        # Order is important - first is top/left
        layout_main.add_widget(text_input)
        layout_main.add_widget(layout)

        return layout_main
    def _on_key_down(self, keyboard, keycode, text, modifiers):
        print(keycode) #for debugging purposes: keycode is just the code associated with every keyboard key with each having a unique number and calling keycode returning a tuple with (number, text)
        nextmove = self.checknextmove(keycode[0]) #Refers to the checknextmove function(using numerical portion of the keycode) to generate a new gameboard
        self.gameboard = nextmove[0] #Checknextmove method creates a tuple with format (new game board(a list), additional score)
        self.boardobject.clear_widgets() #removes all previous labels to return to a clean state
        self.pop_board(self.gameboard)  #repopulates gameboard with new labels representing new gameboard obtained from Checknextmove function
        
        #Updates current game score
        self.scoreboard +=nextmove[1] #updates score value
        self.score.text ='Score' +'\n'+ str(self.scoreboard) #updates score board
        
        #updates highscore if highscore is broken in current game playthrough
        if self.hiscoreboard<self.scoreboard: 
            self.hiscoreboard = self.scoreboard
            self.hiscore.text = 'High Score' +'\n'+ str(self.hiscoreboard)

        #checks board state to see if win/lose/ongoing at the end of each move
        state = self.check_state(self.gameboard) 
        if state == 'win': 
            print('You Won!')
            time_taken = str(int(round(time.time()-self.newtime,0)))
            popupwindow = Popup(title='Congratulations, 2048 achieved!',content=Label(text='You Won!'+'\n' + 'Your Score  ' +str(self.scoreboard)+'\n' + 'Total Time Taken  ' + time_taken),size_hint=(None,None),size=(500,300))
            
        elif state =='gameover':
            print('Game Over')
            time_taken = str(int(round(time.time()-self.newtime,0)))
            popupwindow = Popup(title='Game Over!',content=Label(text='No more moves!'+'\n' + 'Your Score  ' +str(self.scoreboard)+'\n' + 'Total Time Taken  ' + time_taken),size_hint=(None,None),size=(500,300))
            popupwindow.open()
Пример #3
0
    def view_student(self):
        if self.grade12s_list.adapter.selection:
            # getting selected item name
            selection = self.grade12s_list.adapter.selection[0].text

            # creating layout for tab
            content = GridLayout(cols=1)
            content.add_widget(Label(text="Student Name: " + selection))
            for i in self.grade12_list:
                if i.get_student_name() == selection:
                    content.add_widget(
                        Label(text="Homeroom: " + i.get_homeroom()))
                    content.add_widget(
                        Label(text="Student ID: " + str(i.get_id())))
                    content.add_widget(
                        Label(text="Accumulated Points: " +
                              str(i.get_points())))
                    content.add_widget(
                        Label(text="Clubs Involved: " + i.get_clubs()))
            content.add_widget(
                Button(text='View Rewards History',
                       size_hint_y=None,
                       height=40))
            popup = Popup(title=selection,
                          content=content,
                          size_hint=(None, None),
                          size=(400, 400))
            popup.open()
Пример #4
0
    def view_student(self):
        self.update_info()
        if self.grade12s_list.adapter.selection:
            # getting selected item name
            selection = self.grade12s_list.adapter.selection[0].text

            # creating layout for tab
            content = GridLayout(cols=2)
            col1 = GridLayout(cols=1)
            col2 = GridLayout(cols=1)
            col1.add_widget(Label(text="Student Name: " + selection))
            for i in self.grade12_list:
                if i[1] == selection:
                    col1.add_widget(Label(text="Grade: " + i[2]))
                    col1.add_widget(Label(text="Student ID: " + str(i[4])))
                    col1.add_widget(
                        Label(text="Accumulated Points: " + str(i[3])))
                    simple_list_adapter = SimpleListAdapter(
                        data=i[6].split('.')[1:], cls=Label)

            col2.add_widget(
                Label(text='Student Rewards History',
                      size_hint_y=None,
                      height=40))
            activity_history = ListView(adapter=simple_list_adapter)
            col2.add_widget(activity_history)
            content.add_widget(col1)
            content.add_widget(col2)
            popup = Popup(title=selection,
                          content=content,
                          size_hint=(None, None),
                          size=(800, 500))
            popup.open()
Пример #5
0
 def loginFunction(self, username, password):
     if username and password:
         try:
             client = MongoClient()
             db = client['remindersNote']
             cursor = db.users.find({"username": username}).count()
             if cursor > 0:
                 dataUser = db.users.find({
                     "username": username,
                     "password": password
                 }).count()
                 if dataUser > 0:
                     popup = Popup(
                         title='Message',
                         content=Label(text="Account Authenticate"),
                         size_hint=(None, None),
                         size=(200, 80))
                 else:
                     popup = Popup(title='Message',
                                   content=Label(text="Incorrect Password"),
                                   size_hint=(None, None),
                                   size=(200, 80))
             else:
                 popup = Popup(title='Message',
                               content=Label(text="Incorrect Input"),
                               size_hint=(None, None),
                               size=(200, 80))
             popup.open()
         except Exception:
             self.display.text = "Error Input"
     else:
         self.display.text = "Required Field"
Пример #6
0
    def build_songlist(self):
        self.ids.songlist_view.clear_widgets()
        songlist = []

        with open(songlist_file, "r") as infile:
            for line in infile:
                match = re.match("^(.*)::(.*)\n$", line)
                songlist += [Button(text=match.group(1)+" ["+match.group(2)+"]", background_normal="icons/song-normal.png", background_down="icons/song-down.png", \
                             text_size=[580, None], color=[0, 0, 0, 1], valign="middle", halign="left", on_press=self.song, font_size=24, size_hint_y=None, height=50)]

        songlist.sort(key=lambda btn: btn.text.capitalize())
        alpha = ""

        for btn in songlist:
            if btn.text[0].capitalize() != alpha:
                alpha = btn.text[0].capitalize()
                self.ids.songlist_view.add_widget(
                    Label(text="", size_hint_y=None, height=20))
                self.ids.songlist_view.add_widget(
                    Label(text=alpha,
                          text_size=[580, None],
                          valign="middle",
                          halign="left",
                          font_size=32,
                          color=[0, 0, 0, 1],
                          size_hint_y=None,
                          height=50))
            self.ids.songlist_view.add_widget(btn)
Пример #7
0
    def __init__(self,comicBook, **kwargs):
        super(KivySmallComicGui,self).__init__(**kwargs)
        self.size_hint = (None,None)
        self.size = (160,320)
        self.comicBook = comicBook
        self.panelCover=GridLayout(cols=2)
        if os.path.exists("thumnails\\" + str(comicBook.idFila)+".jpg"):
            self.cover = Image(source = "thumnails\\" + str(comicBook.idFila)+".jpg")
        else:
            self.cover = comicBook.getImagePage()
        # self.cover = Image(source="test.jpg")
        self.cover.size_hint = (None,None )
        self.cover.size = (160,220)
        # self.panelCover.add_widget(self.cover)
        # self.panelBotonera = GridLayout(cols=1,size_hint = (0.1, 1))
        # self.panelCover.add_widget(self.panelBotonera)
        # self.panelBotonera.add_widget(Button(text="add",size_hint=(None,None),size=(32,32)))
        self.add_widget(self.cover)
        self.cols=1
        self.panelLabel = GridLayout(cols=2,size_hint_y=.4)

        self.label = Label(text='[ref=world]{}[/ref]'.format(comicBook.getNombreArchivo()), markup=True,
                           text_size=(140, None))
        self.label.bind(on_ref_press=self.showOptions)
        self.add_widget(self.label)
Пример #8
0
    def on_files(self, instance, files):
        if self._pnl_files is None:
            return

        self._pnl_files.clear_widgets()
        if len(files) == 0:
            self._pnl_files.height = 0
            return
        self._pnl_files.size_hint_y = self.size_hint_y
        self._pnl_files.height = self._pnl_files.minimum_height
        for item in files:
            if isinstance(item, Box):
                name = os.path.basename(item.movie)
                image = os.path.basename(item.picture)
                label_v = Label(text=name,
                                font_size=20,
                                size_hint_y=None,
                                height=30)
                # label_i = Label(text=image, font_size=20, size_hint_y=None, height=30)
                self._pnl_files.add_widget(label_v)
                # self._pnl_files.add_widget(label_i)
            else:
                name = os.path.basename(item)
                label = Label(text=name,
                              font_size=20,
                              size_hint_y=None,
                              height=30)
                self._pnl_files.add_widget(label)
Пример #9
0
 def __init__(self, player, **kwargs):
     super().__init__(**kwargs)
     self.orientation = "vertical"
     self.player = player
     self.add_widget(Label(text=self.player.name))
     for target in self.player.targets:
         self.add_widget(Label(text=str(target['shots'])))
     self.add_widget(Label(text=""))
Пример #10
0
    def build(self):

        p = Pan()
        #p.Pan()
        #p.orientation='vertical'
        self.title = "djPlayer"
        p.add_widget(Label(text='prenom'))
        p.add_widget(Label(text='nom'))
        return p
Пример #11
0
	def __init__(self, **kwards):
		super(LoginScreen, self).__init__(**kwards)
		self.cols = 2
		self.add_widget(Label(text='User Name'))
		self.username = TextInput(multiline=False)
		self.add_widget(self.username)
		self.add_widget(Label(text='password'))
		self.password = TextInput(password=True, multiline=False)
		self.add_widget(self.password)
Пример #12
0
    def get_info(self, id):
        """
        Gets the info Dialog for each Stock
        :param id:
        :return:
        """
        dialog = ""
        company = None

        for i in self.dog:
            if str(i).upper() == id.text.upper():
                company = i

        daybefore = None
        price_change = None
        volume_deviation = None
        price_change = None
        if company is not None:
            if self.date not in company.dates:
                daybefore = len(company.dates) - 1
            else:
                daybefore = company.dates.index(self.date) - 1
            price_change = company.get_change_in_price(
                company.dates[daybefore], company.dates[daybefore])
            historical_volume = company.getavg(company.dates[daybefore - 20],
                                               company.dates[daybefore - 1],
                                               "VOLUME")
            today_volume = company.volumes[daybefore]

            volume_deviation = today_volume / historical_volume
            dialog += "Company Name: " + str(
                company.company_name) + "\n" + "\n"
            dialog += "Market-Cap: " + str(millify(company.market_cap)) + "\n"
            dialog += "Sector: " + str(company.sector) + "\n"
            dialog += "Description: " + str(company.description) + '\n'
            dialog += "Price Change: " + str(round(price_change * 100,
                                                   2)) + "%" + "\n"
            dialog += "Volume Deviation: " + str(round(volume_deviation,
                                                       2)) + "\n"

            new_label = Label(text=dialog)
            new_label.font_size = 15
            new_label.color = 1, 1, 1, 1

            popup = Popup(title=id.text,
                          content=new_label,
                          size_hint=(None, None),
                          size=(600, 400))
            popup.open()
        else:
            pass
Пример #13
0
class KivySmallComicGui(GridLayout):
    def __init__(self,comicBook, **kwargs):
        super(KivySmallComicGui,self).__init__(**kwargs)
        self.size_hint = (None,None)
        self.size = (160,320)
        self.comicBook = comicBook
        self.panelCover=GridLayout(cols=2)
        if os.path.exists("thumnails\\" + str(comicBook.idFila)+".jpg"):
            self.cover = Image(source = "thumnails\\" + str(comicBook.idFila)+".jpg")
        else:
            self.cover = comicBook.getImagePage()
        # self.cover = Image(source="test.jpg")
        self.cover.size_hint = (None,None )
        self.cover.size = (160,220)
        # self.panelCover.add_widget(self.cover)
        # self.panelBotonera = GridLayout(cols=1,size_hint = (0.1, 1))
        # self.panelCover.add_widget(self.panelBotonera)
        # self.panelBotonera.add_widget(Button(text="add",size_hint=(None,None),size=(32,32)))
        self.add_widget(self.cover)
        self.cols=1
        self.panelLabel = GridLayout(cols=2,size_hint_y=.4)

        self.label = Label(text='[ref=world]{}[/ref]'.format(comicBook.getNombreArchivo()), markup=True,
                           text_size=(140, None))
        self.label.bind(on_ref_press=self.showOptions)
        self.add_widget(self.label)

    def showOptions(self,obj,evnt):
        # print(obj)
        panel = GridLayout(cols=1)
        panel.add_widget(Button(text="Catalogar usando ComicVine",size_hint_y=None,size=(0,30),on_press=self.catalogComic))
        panel.add_widget(Button(text="ver info comic",size_hint_y=None,size=(0,30)))
        panel.add_widget(Button(text="Leer Comic",size_hint_y=None,size=(0,30), on_press=self.viewComic))

        self.popup = Popup(title='Opciones',
                           content=panel,
                           size_hint=(.6, None),size=(0,150))
        self.popup.open()
    def catalogComic(self,evnt):
        self.popup.dismiss()

        self.popup = KivyVineCataloger(self.comicBook)
        self.popup.open()
    def viewComic(self,evnt):
        self.popup.dismiss()
        self.popup = KivyVisor(self.comicBook)
        self.popup.open()
    def salir(self):
        self.popup.dismiss()
Пример #14
0
    def registerUser(self, pname, email, username, password, cpass):
        if pname and email and username and password and cpass:
            try:
                client = MongoClient()
                db = client['remindersNote']
                cursor = db.users.find({"username": username}).count()
                if cursor <= 0:
                    if password == cpass:
                        popup = Popup(title='Message',
                                      content=Label(text="Account Created"),
                                      size_hint=(None, None),
                                      size=(200, 80))

                        db.users.insert_one({
                            "username":
                            username,
                            "password":
                            password,
                            "personal_details": [{
                                "fullname": pname,
                                "email": email
                            }],
                            "date_registered":
                            time.strftime("%d%m%Y")
                        })

                        popup = Popup(title='Message',
                                      content=Label(text="Account Created"),
                                      size_hint=(None, None),
                                      size=(200, 80))
                        popup.open()
                        sys.exit()
                    else:
                        popup = Popup(title='Message',
                                      content=Label(text="Password Not Match"),
                                      size_hint=(None, None),
                                      size=(200, 80))
                else:
                    popup = Popup(
                        title='Message',
                        content=Label(text="Username Already Exist!"),
                        size_hint=(None, None),
                        size=(200, 80))
                popup.open()
            except Exception:
                self.display.text = "Error Input"
        else:
            self.display.text = "Required Field"
Пример #15
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.orientation = "vertical"
     self.add_widget(Label(text="P", underline=True))
     self.add_widget(Label(text="20"))
     self.add_widget(Label(text="19"))
     self.add_widget(Label(text="18"))
     self.add_widget(Label(text="17"))
     self.add_widget(Label(text="16"))
     self.add_widget(Label(text="15"))
     self.add_widget(Label(text="B"))
     self.add_widget(Label(text=""))
    def submit_report(self):
        student_name = '242423' + " " + 'B' + " " + self.radius_mean_text_input.text + " " + self.texture_mean_text_input.text + " " + self.perimeter_mean_text_input.text + " " + self.area_mean_text_input.text + " " + self.smoothness_mean_text_input.text + " " + self.compactness_mean_text_input.text + " " + self.concavity_mean_text_input.text + " " + self.concave_points_mean_text_input.text + " " + self.symmetry_mean_text_input.text + " " + self.fractal_dimension_mean_text_input.text + " " + self.radius_standard_error_text_input.text + " " + self.texture_standard_error_text_input.text + " " + self.perimeter_standard_error_text_input.text + " " + self.area_standard_error_text_input.text + " " + self.smoothness_standard_error_text_input.text + " " + self.compactness_standard_error_text_input.text + " " + self.concavity_standard_error_text_input.text + " " + self.concave_points_standard_error_text_input.text + " " + self.symmetry_standard_error_text_input.text + " " + self.fractal_dimension_standard_error_text_input.text + " " + self.radius_worst_text_input.text + " " + self.texture_worst_text_input.text + " " + self.perimeter_worst_text_input.text + " " + self.area_worst_text_input.text + " " + self.smoothness_worst_text_input.text + " " + self.compactness_worst_text_input.text + " " + self.concavity_worst_text_input.text + " " + self.concave_points_worst_text_input.text + " " + self.symmetry_worst_text_input.text + " " + self.fractal_dimension_worst_text_input.text
        self.student_list.adapter.data.extend([student_name])
        self.student_list._trigger_reset_populate()

        student_name = list(student_name.split(" "))
        data = pd.read_csv("/Users/sahil/Downloads/data.csv",
                           error_bad_lines=False)

        with open("/Users/sahil/Downloads/data.csv", 'a+') as csvFile:
            writer = csv.writer(csvFile)
            writer.writerow("\n")
            writer.writerow(student_name)

        csvFile.close()
        data.head()
        data = data.set_index('id')
        data.diagnosis.replace(to_replace=dict(B=0, M=1), inplace=True)
        target = np.array(data['diagnosis'])
        cancer = data.drop('diagnosis', axis=1)
        feature_name = np.array(list(cancer))
        cancer = np.array(cancer)
        #cancer = np.append(cancer, [student_name], axis=0)

        target_names = np.array(['malignant', 'benign'])
        x_train, x_test, y_train, y_test = train_test_split(cancer,
                                                            target,
                                                            test_size=0.20,
                                                            random_state=0)
        scaler = MinMaxScaler(feature_range=(0, 1))
        rescaledX = scaler.fit_transform(x_train)
        X_test_scaled = scaler.fit_transform(x_test)
        from sklearn.preprocessing import StandardScaler
        scaler = StandardScaler().fit(x_train)
        rescaledX = scaler.transform(x_train)
        X_test_scaled = scaler.transform(x_test)
        svm2 = SVC(C=2.0)
        svm2.probability = True
        svm2.fit(rescaledX, y_train)
        s = svm2.predict_proba(X_test_scaled[-1:-2:-1])
        v = s[0]
        print(v)
        if v[0] > v[1] * 10:
            print("B")
            return Label(text="B")
        else:
            print("M")
            return Label(text='M')
 def create_widgets(self):
     """
     Create buttons from dictionary entries and add them to the GUI
     """
     for name in self.phonebook:
         temp_button = Label(text=name, id=name)
         self.root.ids.entries_box.add_widget(temp_button)
Пример #18
0
    def __init__(self):
        super(PathInput, self).__init__()
        self.size_hint_y = None
        height = 40
        self.size = (self.width, height)
        self.add_widget(
            Label(text='Path:',
                  size_hint=(.2, None),
                  size=(self.width, height)))
        self.add_widget(State.imported_path)
        self.button = Button(text='Import',
                             size_hint=(.3, None),
                             size=(self.width, height))

        def on_save(file, dirpath):
            filename = file
            with open(filename) as f:
                report = json.load(f)
            State.all_images.set_images(report)

        self.button.bind(on_press=lambda _: choose_file(
            ['*.json'],
            on_save,  # State.all_images.set_images(result),
        ))
        self.add_widget(self.button)
Пример #19
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.orientation = "vertical"
     self.label = Label(text="Select # of Players:")
     self.add_widget(self.label)
     self.player_menu_buttons = PlayerMenuButtons()
     self.add_widget(self.player_menu_buttons)
Пример #20
0
    def aff(self):
        try:
            P.sho()
            s = P.sho.h
            e = P.sho.m
        except:
            s = 9
            e = 23
        i = 1
        for w in range(s, e + 1):
            label = Label(text=str(w))
            self.ids.grid.add_widget(label)

            cursor = conn.cursor()
            cursor.execute(sql, (i, ))
            ka = str(cursor.fetchall())[3:-4]
            conn.commit()

            text = TextInput(multiline=False, text=ka)
            #text.id = 'line'
            #print(text.text)
            text.bind(on_text_validate=on_enter)
            self.ids.grid.add_widget(text)
            i += 1

            self.active = CheckBox(active=False)
            self.ids.grid.add_widget(self.active)
Пример #21
0
    def do_login(self, loginText, passwordText):
        app = App.get_running_app()

        app.username = loginText
        app.password = passwordText
        if loginText == 'root' and passwordText == 'root':
            print("LOGGED IN")
            self.manager.transition = SlideTransition(direction="left")
            self.manager.current = 'options'
            obj = Mail()

        else:
            print("auth failed")
            box = BoxLayout(orientation='vertical', padding=(10))
            box.add_widget(
                Label(text="Please Enter the Correct Login Details"))
            btn1 = Button(text='Close')
            box.add_widget(btn1)
            popup = Popup(title='Incorrect Login',
                          title_size=(30),
                          title_align='center',
                          content=box,
                          size_hint=(None, None),
                          size=(400, 200),
                          auto_dismiss=False)
            btn1.bind(on_press=popup.dismiss)
            popup.open()
Пример #22
0
 def __init__(self):
     amp = get_input(1)
     frq = get_frq(amp)
     power = get_power(amp)
     self.main_text = Label(text=str(get_alpha_power(frq, power)))
     self.add_widget(self.main_text)
     self._disabled_count = 0
Пример #23
0
    def build(self):
 
        # Return a label widget with Hello Kivy
        # The name of the kv file has to be hellokivy
        # minus the app part from this class to
        # match up properly
        return Label()
Пример #24
0
 def build(self):
     layout = GridLayout(cols=1, rows=4)
     self.myLabel = Label(text ='Look Away For 25 Seconds...', font_size="40sp" )
     layout.add_widget(self.myLabel)
     Clock.schedule_interval(self.Callback_Clock, 1)
     Clock.schedule_once(App.get_running_app().stop, 25)
     
     if True: 
         layout.add_widget(Label(text=""))
         ButtonSkip = Button(text ="Skip",size_hint_x=None, width=(50/100*width))#
         layout1 = AnchorLayout(anchor_x='center', anchor_y='bottom')
         layout1.add_widget(ButtonSkip)
         layout.add_widget(layout1)
         ButtonSkip.bind(on_press= App.get_running_app().stop)
         layout.add_widget(Label(text=""))
     return layout
Пример #25
0
 def submit(self, ip):
     print(ip)
     obj = Mail()
     s = obj.show_mails(ip)
     print(s)
     y = Label(text=str(s), font_size=24)
     self.output.add_widget(y)
Пример #26
0
    def __init__(self, **kwargs):
        # make sure we aren't overriding any important functionality
        super(KivyConfigGui, self).__init__(**kwargs)
        self.babelComicConfig = babelComicConfig = BabelComicBookManagerConfig(
        )
        self.panelPrincipal = GridLayout(cols=1)
        self.grilla = GridLayout(cols=2)
        self.panelPrincipal.add_widget(self.grilla)

        self.abmClaves = KivyPanelABM(babelComicConfig.listaClaves, "Clave")
        self.abmDirectorios = KivyPanelABM(babelComicConfig.listaDirectorios,
                                           "Directorio")
        self.abmTipos = KivyPanelABM(babelComicConfig.listaTipos,
                                     "Tipo Archivo")

        self.grilla.add_widget(self.abmClaves)
        self.grilla.add_widget(self.abmDirectorios)
        self.grilla.add_widget(self.abmTipos)
        self.grilla.add_widget(KivyPanelScanner())

        self.btnGuardar = Button(text="Guardar",
                                 size_hint_y=None,
                                 size=(0, 20))
        self.panelPrincipal.add_widget(self.btnGuardar)
        self.btnGuardar.bind(on_press=self.btnGuardarEvnt)
        self.statusText = Label(size_hint_y=None, size=(0, 20))
        self.panelPrincipal.add_widget(self.statusText)
        self.add_widget(self.panelPrincipal)
Пример #27
0
 def build(self):
     self.title = "Dynamic Widget App"
     self.root = Builder.load_file('dynamic_app.kv')
     for name in self.name_list:
         temp_label = Label(text=name)
         self.root.ids.list_names.add_widget(temp_label)
     return self.root
Пример #28
0
    def on_enter(self):
        try:
            self.ids.triggerlisting.clear_widgets()
            self.ids.SlotNo.text = "Slot " + str(
                self.manager.select_group_screen.currentSlot)
            for i in xrange(0, len(self.manager.groupList)):
                addedGroup = BoxLayout(size_hint_y=None,
                                       height='75sp',
                                       orientation='horizontal',
                                       id=str(self.manager.groupList[i].index))

                addedGroup.add_widget(
                    Label(text="Group " + str(self.manager.groupList[i].index),
                          font_size=25,
                          color=(0, 0, 0, 1)))

                button = Button(id=str(self.manager.groupList[i].index),
                                text="Apply Trigger",
                                size_hint_x=None,
                                width=175)
                button.bind(on_press=self.apply_trigger)

                addedGroup.add_widget(button)

                self.ids.triggerlisting.add_widget(addedGroup)
                print addedGroup.id
        except Exception:
            print('Error in the on_enter function!')
 def view_activity(self):
     if self.reward_list.adapter.selection:
         selection = self.reward_list.adapter.selection[0].text
         ran = Code()
         s = ran.get_new_code()
         content = GridLayout(cols=1)
         content.add_widget(Label(text="Activity Name: " + selection))
         content.add_widget(Label(text="Amount of Points: " + selection))
         content.add_widget(Label(text="Rewards Code: " + str(s)))
         content.add_widget(
             Button(text='Reward Points', size_hint_y=None, height=40))
         popup = Popup(title=selection,
                       content=content,
                       size_hint=(None, None),
                       size=(400, 400))
         popup.open()
Пример #30
0
 def oi(self):
     j = 1
     for i in range(0, 25):
         if i % 2 == 0:
             if j < 4:
                 self.ids["outros"].add_widget(Label(text=""))
                 j += 1
             else:
                 self.ids["outros"].add_widget(Label(text="Mesa"))
                 if j == 5:
                     j = 1
                 else:
                     j += 1
         else:
             self.ids["outros"].add_widget(
                 Button(background_color=(0, 128, 0, 0.7), text="Cadeira"))
Пример #31
0
 def build(self):
     self.a = 0
     cnt = BoxLayout(orientation='vertical')
     #cnt = GridLayout()
     enter = Button(text='enter')
     self.data = Label(text="Your Data", font_size='27sp')
     #cnt.add_widget(self.data)
     cnt.add_widget(HelloKivy.l1)
     #l.bind(on_ref_press=callback)
     enter.bind(on_press=self.callback)
     cnt.add_widget(enter)
     self.txt1 = TextInput(text='Enter subject Here', multiline=False)
     cnt.add_widget(self.txt1)
     getData = Button(text='getData', size=(80, 80))
     getData.bind(on_press=self.get_data)
     cnt.add_widget(getData)
     clear = Button(text="clear screen")
     clear.bind(on_press=self.clear_screen)
     #cnt.add_widget(clear)
     #self.popup = Popup(title='Test popup',
     #content=Label(text="pop pop 123"),
     #size_hint=(None, None), size=(150,150))
     #self.popup.open()
     Window.mimium_height = 150.
     Window.mimium_width = 150.
     Window.size = (300, 300)
     #Window.borderless = True
     #Window.minimize()
     #Window.grab_mouse()
     #Window.raise_window()
     #Window.allow_screensaver = True
     mini = Button(text="minimize")
     mini.bind(on_press=self.minimize)
     cnt.add_widget(mini)
     return cnt