N
N
noky582017-12-16 10:54:30
Python
noky58, 2017-12-16 10:54:30

Why doesn't the class change in the kv file when the button is clicked?

Good day. Why doesn’t the class change in the kv file when the button is pressed? I press the button and, in fact, there should be a transition between classes. That is, the main function now returns instead of the wirtul class, the widget class and vice versa. But this does not happen, or rather the window itself does not light up. Tell me what's the matter and how can I implement my idea? Thank you in advance!
Here is the .py file code:

from kivy.app import App
from kivy.uix.widget import Widget
from kivy.lang import Builder
class Wirtul(Widget):
    pass
class Widgets(Widget):
    pass
presentation = Builder.load_file("SimpleKivy.kv")
class SimpleKiv(App):
    def build(self):
        return presentation
if __name__=="__main__":
    Myapp=SimpleKiv()
    Myapp.run()

а это файл SimpleKivy.kv
<Widgets>:
    name:'main'
  Button:
    size:self.minu_ki
      pos:0,0
      text: "chit"
      color: 0,1,0,1
    font_size: 40
    on_release:app.root.current = 'high'
<Wirtul>:
    name:'high'
  Button:
      size: 170,75
    pos: 100,0
    text: "naz"
    color: 1,0,0,1
    font_size: 40
    on_release: app.root.current = 'main'

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question