Перечислите все имена в базе данных в приложении kivy - PullRequest
0 голосов
/ 01 апреля 2020

Я создаю приложение и хочу, чтобы оно перечисляло все имена, адрес электронной почты, сектор и дату создания всех пользователей в базе данных. На данный момент, это просто показывает информацию о текущем пользователе. Это python код

class MainWindow(Screen):
n = ObjectProperty(None)
created = ObjectProperty(None)
email = ObjectProperty(None)
current = ""
sector= ObjectProperty(None)

def logOut(self):
    sm.current = "login"

def on_enter(self, *args):
    password, name, created, sector = db.get_user(self.current)
    self.n.text = "Account Name: " + name
    self.email.text = "Email: " + self.current
    self.created.text = "Created On: " + created
    self.sector.text = "Sector: " + sector

Это соответствующий файл KIVY

<MainWindow>:
canvas.before:
    Rectangle:
        pos: self.pos
        size: self.size
        source: 'back2.jpg'

n: n
email: email
created:created
sector:sector

FloatLayout:
    Label:
        id: n
        pos_hint:{"x": 0.1, "top":0.9}
        size_hint:0.8, 0.2
        text: "Name: "
        color: 0, 0, 1, .5

    Label:
        id: email
        pos_hint:{"x": 0.1, "top":0.7}
        size_hint:0.8, 0.2
        text: "Email: "
        color: 0, 0, 1, .5

    Label:
        id: created
        pos_hint:{"x": 0.1, "top":0.5}
        size_hint:0.8, 0.2
        text: "Created: "
        color: 0, 0, 1, .5

    Label:
        id: sector
        pos_hint:{"x": 0.1, "top":0.3}
        size_hint:0.8, 0.2
        text: "Sector: "
        color: 0, 0, 1, .5

1 Ответ

0 голосов
/ 01 апреля 2020

Вопрос , где именно точно у вас проблема, ваш вопрос недостаточно описательный

...