Storing variables from ui panel I am new to python and scripting for blender, I'm using 2.8. I would love go have a text box field in a UI panel that the user can enter a value and its stored on a variable. My full plan is to have multiple boxes for when you have to make repetitive scaling you can just enter the numbers once then apply them to any object you want.
Slightly related to that, how do you have the value of a variable displayed as text in the U
Quick and dirty:
bpy.context.scene['MyProperty'] = 5 # or 'yay' or whatever

You do not have to declare anything when using this method.But this is adding to the struct &quot;scene&quot;, more practical:
bpy.types.Scene.MyProperty = 5 # registers a new variable to the scene
print(bpy.context.scene.MyProperty) # prints 5

Cleanest way I know of:
bpy.types.Scene.MyProperty = bpy.props.FloatProperty()

If you want to use it as part of an addon, you may want to check if MyProperty registered already, otherwise you risk overwriting settings from the previous session.
More information: https://docs.blender.org/api/current/bpy.props.html
To display your value, you can use any field with information, e.g.
def draw(self, context):
    self.layout.label(text=str(bpy.context.scene.MyProperty)) 

More info about panels here: https://docs.blender.org/api/current/bpy.types.Panel.html