Answer the question
In order to leave comments, you need to log in
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()
<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
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question