Skip to content
Advertisement

How do I have a label display a string with a text input variable using python in Kivy without the kv. file?

For context, I am creating a simple golf app. Unfortunately, I’ve run into an issue which really seems like it should be easy to solve but I can’t figure it out. I’m trying to have the 3rd screen (RegisterWindow) say “Hi (the username the user inputs in the screen before)” by adding the variable I have set to whatever the user puts in, which is username. However, the code I have below gives me an attribute error. How do I fix this issue without using a kv. file?

JavaScript

Advertisement

Answer

There are several ways to achieve that. One of the shortest way could be assigning the value directly to the Label instance of RegisterWindow.

For that first keep there a reference of the Label as,

JavaScript

Then use any one of the methods (say, screen_transition) of your LoginWindow (that you have bound to the Button) to pass the desired values as,

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement