Last active
April 9, 2018 17:50
-
-
Save pessi-v/def59a15936e37e2f309ef69a0e121c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#:import Factory kivy.factory.Factory | |
#:import Popup kivy.uix.popup | |
<MyPopup@Popup>: | |
BoxLayout: | |
cols: 2 | |
RstDocument: | |
id: rsttext2 | |
MyButton: | |
text: "text changer" | |
on_press: self.change_text2() | |
GridLayout: | |
cols:2 | |
Button: | |
text: "popup" | |
on_press: Factory.MyPopup().open() | |
MyButton: | |
text: "text changer" | |
on_press: self.change_text1() | |
RstDocument: | |
id:rsttext1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.app import App | |
from kivy.uix.widget import Widget | |
from kivy.core.window import Window | |
from kivy.uix.button import Button | |
from kivy.uix.popup import Popup | |
from kivy.uix.rst import RstDocument | |
class MyButton(Button): | |
def change_text1(self): | |
textfield = self.parent.ids['rsttext1'] | |
textfield.text = "whatever" | |
def change_text2(self): | |
textfield = self.parent.parent.parent.parent.ids['rsttext2'] | |
textfield.text = "success" | |
class MyPopup(Popup): | |
pass | |
class RSTApp(App): | |
pass | |
if __name__ == '__main__': | |
RSTApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment