简体   繁体   English

登录界面 kivy/kivymd

[英]Login Screen kivy/kivymd

I am creating an app using python (kivy and kivymd) and I have a login screen but every time I open my application I will get this screen,how can I make to appear once and disappear permanently?我正在使用 python(kivy 和 kivymd)创建一个应用程序,我有一个登录屏幕,但每次我打开我的应用程序时,我都会看到这个屏幕,我怎样才能让出现一次并永久消失?

Use a config file to store the information to decide whether to open the login screen.使用配置文件来存储信息来决定是否打开登录屏幕。

The following code will help:以下代码将有所帮助:

It tries to read a 'temp.txt' file它尝试读取“temp.txt”文件

On first run, there is no such file and an exception will be thrown calling the except block第一次运行时,没有这样的文件,将抛出调用 except 块的异常

Code:代码:

global k
try:
    with open('temp.txt','r') as file:
        p = file.read()
        global k
        k = False
except:
    global k
    with open('temp.txt','w') as file:
        file.write('1')
    k = True
class Management(ScreenManager):
    def __init__(self,*kwargs):
        global k
        if k:
            self.current = 'LoginScreen'
        else:
            self.current = 'HomeScreen'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从登录屏幕(没有 navigationdrawer 布局)切换到具有 navigationdrawer 布局的屏幕 python/kivy/kivymd - How to Switch from a login screen (without the navigationdrawer layout) to a screen with a navigationdrawer layout python/kivy/kivymd 如果我在另一个屏幕中,我如何获取屏幕的 MDTextField(或数据“登录”)的文本。 (基维/基维MD/Python) - How can i get the text of an MDTextField (Or Data "Login") of an screen if im in another Screen. (Kivy / KivyMD / Python) 如何使用 kivy 或 kivyMD 覆盖 android 屏幕? - how to overlay android screen using kivy or kivyMD? 使用按钮更改 kivy 或 kivymd 中的屏幕 - change screen in kivy or kivymd with press button KivyMD:独立的登录屏幕和 MDBottomNavigation - KivyMD: An independent Login screen and MDBottomNavigation kivy中的功能登录屏幕 - Functional login screen in kivy Kivy 屏幕管理器当前屏幕没有切换(至少在视觉上没有)。 使用 kivymd - Kivy screenmanager current screen not switching (at least not visually). Using kivymd 如何使用 kivymd 在 Kivy 的屏幕上动态显示文本? - How to display text dynamically on screen in Kivy using kivymd? Python Kivy/kivyMD 在认证页面加载第二屏方法 - Python Kivy/kivyMD load second screen method in authentication page Kivy登录屏幕和弹出窗口出错 - Error with Kivy Login screen and popup
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM