0

I am trying to make an app with kivy and kivymd but I can't figure out how I can make the setup screen show up only the first time. This is how the application is going to work: User launches the application after installation and is being shown the sign up/log in screen, And once the user is done with the setup, the setup screens will never appear again unless the user reinstalls the application.

How can I make this happen? Please help and thanks SO much in advance!

taha kalaee
  • 133
  • 5
  • What setup screen? – Klaus D. Feb 02 '21 at 08:19
  • If your setup screen accomplishes something, then you just check if that thing has been accomplished and decide which screen to show based on tat determination. – John Anderson Feb 02 '21 at 13:35
  • @JohnAnderson I'm trying to use SignUp / LogIn screens only the first time that the user launches the application.Once the user is done with signing up / logging in those screens should never appear again unless the user reinstalls the application.I am about to use a boolean object to check if those screens have been shown or not,but I don't think this is the correct way. – taha kalaee Feb 03 '21 at 06:59
  • Does your `SignUp` save any information in a file or database? – John Anderson Feb 03 '21 at 14:03
  • @JohnAnderson yes.It sends the user information to the database. – taha kalaee Feb 04 '21 at 08:34
  • Then check for that information in the database and decide which screen to show based on that. – John Anderson Feb 04 '21 at 13:13
  • @JohnAnderson.Thank you so much.But I think there should be another way to do this without checking the database,a way to check the system or something like this. – taha kalaee Feb 07 '21 at 10:19

2 Answers2

1

I fixed this problem by creating and reading a "text" file.My "text" file has '0' as a boolean variable .Once the user is done with signing up / logging in , I change that "text" file to '1' ,and in the __init__ func, I check if that file equals to '0' or '1'. I'm not sure if this is the correct way or not,but this worked for me.

taha kalaee
  • 133
  • 5
0

It is so easy just follow this: First import os module and then use a conditional statement

Note: Here I have two screens, 'start' and 'intro' , I want to show my 'intro' screen if it's the first time the user start the app, and for next times he/she won't face this screen ever. If user started this app before there will be 'database.db' file and app should start with 'start' screen, otherwise app should be started with 'intro' screen which for me contains an function.

Code will be something like the following:

from os.path import exists

def on_enter(self,*args):

    if exists('database.db'):
        self.ids.screenmanager.current = 'start'
    else:
        self.animIt()

my kvfile is like this:

<MyScreen>:
    MDScreenManager:
        id:screenmanager
        MDScreen:
            name:'intro'
        MDScreen:
            name:'start'

Depending on your app items change