Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
139 views
in Technique[技术] by (71.8m points)

python - Dynamic screens in kivymd

I've been working with kivymd for awhile and I wanna create a screen in which it's contents will change depending on content that is clicked for example let's say I have a home screen with products and when each product is clicked another screen will open with the image and details of that specific product and that should be possible for each other product

question from:https://stackoverflow.com/questions/65898199/dynamic-screens-in-kivymd

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use 2 screens for this.

  1. MainScreen to show all the products
  2. Productscreen to show details of the product.

You can add the contents on the screen according to the product being clicked. This way, you do not need to create a separate screen for each product.

Note: Since the contents on the productscreen will be added at runtime, you will need to write it in .py file and not .kv file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...