Advertisement
Scarla

Kutu.kv

May 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. <ScreenManagement>:
  2. MenuScreen:
  3. name: 'menu'
  4. CalculatorScreen:
  5. name: 'calculator'
  6. SecondScreen:
  7. name: 'screen 2'
  8.  
  9. <MenuScreen>:
  10. BoxLayout:
  11. cols: 3
  12. rows: 2
  13. Button:
  14. text: 'Goto\nBasic Calculator'
  15. multiline: True
  16. on_press: root.manager.current = 'calculator'
  17. Button:
  18. text: 'Screen 2'
  19. on_press: root.manager.current = 'screen 2'
  20.  
  21. <CalculatorScreen>:
  22. Calculator:
  23.  
  24. <CustButton@Button>:
  25. font_size: 32
  26. background_color: 0,0,0,0
  27. canvas.before:
  28. Color:
  29. rgba: ( .44, .50, .56, .7) if self.state=='normal' else (0,.7,.7,1)
  30. RoundedRectangle:
  31. pos: self.pos
  32. size: self.size
  33. radius: [18, ]
  34.  
  35. <RawLayout@BoxLayout>:
  36. spacing: 8
  37. padding: 5
  38. size_hint: [1, .5]
  39.  
  40. <Calculator>:
  41. id: calculator
  42. rows: 10
  43. display: entry
  44. spacing: 1
  45.  
  46. BoxLayout:
  47. size_hint: [1, .2]
  48. Label:
  49. text: 'Basic Calculator'
  50. Label:
  51. text: 'Made by Xrew'
  52.  
  53. BoxLayout:
  54. padding: 8
  55. TextInput:
  56. id: entry
  57. spacing: 1
  58. padding: 5
  59. font_size: 32
  60. multiline: True
  61. focus: False
  62. halign: 'center'
  63. background_normal: ' '
  64. background_color: [.92, 1, 0.9, 1]
  65.  
  66. RawLayout:
  67. CustButton:
  68. text: 'Exit'
  69. on_release: root.manager.current = root.manager.previous()
  70. CustButton:
  71. text: '<'
  72. on_press: entry.text += self.text
  73. CustButton:
  74. text: '>'
  75. on_press: entry.text += self.text
  76. CustButton:
  77. text: '≈'
  78. on_press: entry.text += '=='
  79. CustButton:
  80. text: '≠'
  81. on_press: entry.text += '!='
  82.  
  83. CustButton:
  84. text: 'RMD'
  85. on_press: entry.text += '%'
  86.  
  87. RawLayout:
  88. orientation: 'horizontal'
  89. CustButton:
  90. text: '('
  91. on_press: entry.text += '('
  92. CustButton:
  93. text: ')'
  94. on_press: entry.text += ')'
  95. CustButton:
  96. text: '√x'
  97. on_press: entry.text += '**(.5)'
  98. CustButton:
  99. text: '¹/x'
  100. on_press: entry.text += '1/'
  101. RawLayout:
  102. orientation: 'horizontal'
  103. CustButton:
  104. text: 'DEL'
  105. canvas.before:
  106. Color:
  107. rgba: (1, .3, .4, .85) if self.state=='normal' else (0,.7,.7,1)
  108. RoundedRectangle:
  109. pos: self.pos
  110. size: self.size
  111. radius: [18, ]
  112. on_press: entry.text = entry.text[:-1]
  113. CustButton:
  114. text: 'x²'
  115. on_press: entry.text += '**2'
  116. CustButton:
  117. text: 'xⁿ'
  118. on_press: entry.text += '**'
  119. CustButton:
  120. text: 'π'
  121. on_press: entry.text += '3.14'
  122.  
  123. RawLayout:
  124. orientation: 'horizontal'
  125. cols: 4
  126. CustButton:
  127. text: 'CLR'
  128. background_color: 0,0,0,0
  129. canvas.before:
  130. Color:
  131. rgba: (1, .3, .4, .85) if self.state=='normal' else (0,.7,.7,1)
  132. RoundedRectangle:
  133. pos: self.pos
  134. size: self.size
  135. radius: [18, ]
  136. # background_normal: ' '
  137. # background_color: 1, .3, .4, .85
  138. on_press: entry.text = ""
  139. CustButton:
  140. text: 'F.Dv'
  141. on_press: entry.text += '//'
  142. font_size: 32
  143. CustButton:
  144. text: '÷'
  145. on_press: entry.text += '/'
  146. CustButton:
  147. text: '×'
  148. on_press: entry.text += '*'
  149.  
  150. RawLayout:
  151. rows: 1
  152. orientation: 'horizontal'
  153. CustButton:
  154. text: '7'
  155. on_press: entry.text += self.text
  156. CustButton:
  157. text: '8'
  158. on_press: entry.text += self.text
  159. CustButton:
  160. text: '9'
  161. on_press: entry.text += self.text
  162. CustButton:
  163. text: '-'
  164. on_press: entry.text += self.text
  165.  
  166. RawLayout:
  167. orientation: 'horizontal'
  168. rows: 1
  169. CustButton:
  170. text: '4'
  171. on_press: entry.text += self.text
  172. CustButton:
  173. text: '5'
  174. on_press: entry.text += self.text
  175. CustButton:
  176. text: '6'
  177. on_press: entry.text += self.text
  178. CustButton:
  179. text: '+'
  180. on_press: entry.text += self.text
  181.  
  182. RawLayout:
  183. orientation: 'horizontal'
  184. cols: 3
  185. CustButton:
  186. text: '1'
  187. size_hint: [.5, 1]
  188. on_press: entry.text += self.text
  189. CustButton:
  190. text: '2'
  191. size_hint: [.5, 1]
  192. on_press: entry.text += self.text
  193. CustButton:
  194. text: '3'
  195. size_hint: [.5, 1]
  196. on_press: entry.text += self.text
  197. CustButton:
  198. text: ' '
  199. size_hint: [.5, 1]
  200. background_normal: ' '
  201. background_color: .3, .3, .3, 1
  202.  
  203. RawLayout:
  204. orientation: 'horizontal'
  205. # size_hint: [1, .2]
  206. CustButton:
  207. text: '0'
  208. on_press: entry.text += self.text
  209. size_hint: [.34, 1]
  210. CustButton:
  211. text: '.'
  212. on_press: entry.text += self.text
  213. size_hint: [.17, 1]
  214. font_size: 32
  215. CustButton:
  216. text: '='
  217. on_press: calculator.calculate(entry.text)
  218. size_hint: [.17, 2.15]
  219. canvas.before:
  220. Color:
  221. rgba: (0, 255, 255, 1 ) if self.state == 'normal' else (0,0,255,1)
  222. RoundedRectangle:
  223. pos: self.pos
  224. size: self.size
  225. radius: [18, ]
  226.  
  227. <SecondScreen>:
  228. BoxLayout:
  229. orientation: 'horizontal'
  230. size_hint: [1, .1]
  231. Button:
  232. text: 'BMI'
  233. Button:
  234. text: 'BMR'
  235. Button:
  236. text: '1MR'
  237. Button:
  238. text: 'Exit'
  239. on_release: root.manager.current = root.manager.previous()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement