Guest User

Untitled

a guest
May 20th, 2018
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. class Screen1(Screen):
  2. pass
  3.  
  4. class Screen2(Screen):
  5. pass
  6.  
  7. class MyManager(ScreenManager):
  8. pass
  9.  
  10. class PopUp(Popup):
  11. def changeText(self,nameStr):
  12. self.ids.label.text = "You are on Screen %s!" %nameStr #this is text that I want to display
  13.  
  14. class PrimaryApp(App):
  15. def build(self):
  16. return MyManager()
  17.  
  18. PrimaryApp().run()
  19.  
  20. #:import Factory kivy.factory.Factory
  21. <MyManager>:
  22. Screen1:
  23. id: screen1
  24. Screen2:
  25. id: screen2
  26.  
  27. <Screen1>:
  28. name: "one"
  29. GridLayout:
  30. id: grid
  31. rows: 2
  32. Button:
  33. id: button1
  34. text: "Go to Screen Two"
  35. on_release: root.manager.current = "two"
  36. Button:
  37. id: button2
  38. text: "Display Popup"
  39. on_release:
  40. Factory.PopUp().changeText(root.name)
  41. Factory.PopUp().open()
  42. <Screen2>:
  43. name: "two"
  44. GridLayout:
  45. id: grid
  46. rows: 2
  47. Button:
  48. id: button1
  49. text: "Go to Screen One"
  50. on_release: root.manager.current = "one"
  51. Button:
  52. id: button2
  53. text: "Display Popup"
  54. on_release:
  55. Factory.PopUp().changeText(root.name)
  56. Factory.PopUp().open()
  57.  
  58.  
  59. <PopUp>:
  60. id:pop
  61. size_hint: (.5,.5)
  62. title: "Notice!"
  63. Label:
  64. id: label
  65. text: "PLACEHOLDER TEXT" #this is not the code I want displayed
Add Comment
Please, Sign In to add comment