N
N
noky582017-11-12 14:26:23
IT education
noky58, 2017-11-12 14:26:23

How to display the contents of the second class in the window when the button in the first class (kivy) is clicked?

How to display the contents of the second class in the window when the button in the first class is clicked?
Here is the code:

from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.widget import Widget
from kivy.uix.button import Button
class Wirtuling(Widget):
    def btn_clk_d(self):
        self.nu.text="OK"
    def btn_clk_f(self):
       return Widgets()
class Widgets(Widget):
    def __init__(self):
        super(Widgets, self).__init__()
    def btn_clk_b(self):
       return Wirtuling()
class SimpleKivy(App):
    def build(self):
        return Widgets()
myApp = SimpleKivy()
myApp.run()

And here is the kv file:
<Widgets>:
    Button:
        size: 170,75
        pos: 100,0
        text: "sb"
        color: 1,0,0,1
        font_size: 40
        on_press: root.btn_clk_b()
<Wirtuling>:
    nu:nu_c
    Button:
        size: 170,75
        pos: 0,0
        text: "play"
        color: 0,1,0,1
        font_size: 40
        on_press: root.btn_clk_d()
    Button:
        size: 170,75
        pos: 100,0
        text: "naz"
        color: 1,0,0,1
        font_size: 40
        on_press: root.btn_clk_f()
    TextInput:
        id: nu_c
        size: 300,300
        pos: 300,0
        text: ""
        color: 1,0,0,1
        font_size: 40
    TextInput:
        id: nu_d
        size: 300,300
        pos: 300,300
        text: ""
        color: 1,0,0,1
        font_size: 40

Tell me what's wrong? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
raiboon, 2019-08-20
@ych67

matlab and python.

S
Sergey Gornostaev, 2019-08-20
@sergey-gornostaev

R or Wolfram .

U
user49981, 2019-08-20
@user49981

C++ obviously

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question