Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ScreenManagement>:
- MenuScreen:
- name: 'menu'
- CalculatorScreen:
- name: 'calculator'
- SecondScreen:
- name: 'screen 2'
- <MenuScreen>:
- BoxLayout:
- cols: 3
- rows: 2
- Button:
- text: 'Goto\nBasic Calculator'
- multiline: True
- on_press: root.manager.current = 'calculator'
- Button:
- text: 'Screen 2'
- on_press: root.manager.current = 'screen 2'
- <CalculatorScreen>:
- Calculator:
- <CustButton@Button>:
- font_size: 32
- background_color: 0,0,0,0
- canvas.before:
- Color:
- rgba: ( .44, .50, .56, .7) if self.state=='normal' else (0,.7,.7,1)
- RoundedRectangle:
- pos: self.pos
- size: self.size
- radius: [18, ]
- <RawLayout@BoxLayout>:
- spacing: 8
- padding: 5
- size_hint: [1, .5]
- <Calculator>:
- id: calculator
- rows: 10
- display: entry
- spacing: 1
- BoxLayout:
- size_hint: [1, .2]
- Label:
- text: 'Basic Calculator'
- Label:
- text: 'Made by Xrew'
- BoxLayout:
- padding: 8
- TextInput:
- id: entry
- spacing: 1
- padding: 5
- font_size: 32
- multiline: True
- focus: False
- halign: 'center'
- background_normal: ' '
- background_color: [.92, 1, 0.9, 1]
- RawLayout:
- CustButton:
- text: 'Exit'
- on_release: root.manager.current = root.manager.previous()
- CustButton:
- text: '<'
- on_press: entry.text += self.text
- CustButton:
- text: '>'
- on_press: entry.text += self.text
- CustButton:
- text: '≈'
- on_press: entry.text += '=='
- CustButton:
- text: '≠'
- on_press: entry.text += '!='
- CustButton:
- text: 'RMD'
- on_press: entry.text += '%'
- RawLayout:
- orientation: 'horizontal'
- CustButton:
- text: '('
- on_press: entry.text += '('
- CustButton:
- text: ')'
- on_press: entry.text += ')'
- CustButton:
- text: '√x'
- on_press: entry.text += '**(.5)'
- CustButton:
- text: '¹/x'
- on_press: entry.text += '1/'
- RawLayout:
- orientation: 'horizontal'
- CustButton:
- text: 'DEL'
- canvas.before:
- Color:
- rgba: (1, .3, .4, .85) if self.state=='normal' else (0,.7,.7,1)
- RoundedRectangle:
- pos: self.pos
- size: self.size
- radius: [18, ]
- on_press: entry.text = entry.text[:-1]
- CustButton:
- text: 'x²'
- on_press: entry.text += '**2'
- CustButton:
- text: 'xⁿ'
- on_press: entry.text += '**'
- CustButton:
- text: 'π'
- on_press: entry.text += '3.14'
- RawLayout:
- orientation: 'horizontal'
- cols: 4
- CustButton:
- text: 'CLR'
- background_color: 0,0,0,0
- canvas.before:
- Color:
- rgba: (1, .3, .4, .85) if self.state=='normal' else (0,.7,.7,1)
- RoundedRectangle:
- pos: self.pos
- size: self.size
- radius: [18, ]
- # background_normal: ' '
- # background_color: 1, .3, .4, .85
- on_press: entry.text = ""
- CustButton:
- text: 'F.Dv'
- on_press: entry.text += '//'
- font_size: 32
- CustButton:
- text: '÷'
- on_press: entry.text += '/'
- CustButton:
- text: '×'
- on_press: entry.text += '*'
- RawLayout:
- rows: 1
- orientation: 'horizontal'
- CustButton:
- text: '7'
- on_press: entry.text += self.text
- CustButton:
- text: '8'
- on_press: entry.text += self.text
- CustButton:
- text: '9'
- on_press: entry.text += self.text
- CustButton:
- text: '-'
- on_press: entry.text += self.text
- RawLayout:
- orientation: 'horizontal'
- rows: 1
- CustButton:
- text: '4'
- on_press: entry.text += self.text
- CustButton:
- text: '5'
- on_press: entry.text += self.text
- CustButton:
- text: '6'
- on_press: entry.text += self.text
- CustButton:
- text: '+'
- on_press: entry.text += self.text
- RawLayout:
- orientation: 'horizontal'
- cols: 3
- CustButton:
- text: '1'
- size_hint: [.5, 1]
- on_press: entry.text += self.text
- CustButton:
- text: '2'
- size_hint: [.5, 1]
- on_press: entry.text += self.text
- CustButton:
- text: '3'
- size_hint: [.5, 1]
- on_press: entry.text += self.text
- CustButton:
- text: ' '
- size_hint: [.5, 1]
- background_normal: ' '
- background_color: .3, .3, .3, 1
- RawLayout:
- orientation: 'horizontal'
- # size_hint: [1, .2]
- CustButton:
- text: '0'
- on_press: entry.text += self.text
- size_hint: [.34, 1]
- CustButton:
- text: '.'
- on_press: entry.text += self.text
- size_hint: [.17, 1]
- font_size: 32
- CustButton:
- text: '='
- on_press: calculator.calculate(entry.text)
- size_hint: [.17, 2.15]
- canvas.before:
- Color:
- rgba: (0, 255, 255, 1 ) if self.state == 'normal' else (0,0,255,1)
- RoundedRectangle:
- pos: self.pos
- size: self.size
- radius: [18, ]
- <SecondScreen>:
- BoxLayout:
- orientation: 'horizontal'
- size_hint: [1, .1]
- Button:
- text: 'BMI'
- Button:
- text: 'BMR'
- Button:
- text: '1MR'
- Button:
- text: 'Exit'
- on_release: root.manager.current = root.manager.previous()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement