I'm not exactly new to python but wouldn't I know it well and fully, but I'm completely new to Kivy. It's just a small thing I'm doing just to start somewhere. I'm working in Visual Studio Code(VSC). Python version 3.10. The idea is: there are 5 buttons, each button has a name, when you click on a button, image(meme) should show up. Here is the full code, terminal, debugger and what is in command prompt:
code code
Terminal Terminal
Debugger Debugger
Command Prompt Command Prompt
Here is python itself and a folder "Projects" C:\Users\Кирилл\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.10 enter image description here
Here is folder with virtual environment(App_EPQ) and a folder with code(App_code) C:\Users\Кирилл\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.10\Projects enter image description here
Thanks in advance
Tried to rewrite the code but that didn't work. Tried to find someone with a similar problem no luck there also. No idea what to do next and how to fix it so this is my last hope.
Your class has to inherit a layout as well as App:
class HBoxLayoutExample(BoxLayout, App)
Another way to do it would be to create a class that builds the app and returns the layout:
class HBoxLayoutExample(BoxLayout)
**your code**
class HBoxApp(App):
def build(self):
return HBoxLayoutExample
if __name__ == '__main__':
HBoxApp().run()
as shown here https://kivy.org/doc/stable/guide/lang.html#designing-with-the-kivy-language
Replace your line:
return layout, button
with:
return layout
That's all. build()
method have to return one widget, which in your case is BoxLayout instance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.