Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 10th, 2020 201 in 314 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from kivy.app import App
  2. from kivy.uix.button import Button
  3. from kivy.uix.widget import Widget
  4. from kivy.uix.label import Label
  5. from kivy.uix.gridlayout import GridLayout
  6. from kivy.uix.boxlayout import BoxLayout
  7. from kivy.config import Config
  8.  
  9. Config.set('graphics', 'resizable', 0)
  10. Config.set('graphics', 'width', 500)
  11. Config.set('graphics', 'height', 800)
  12.  
  13.  
  14.  
  15.  
  16.  
  17.    
  18. class GazApp(App):
  19.    
  20.     def ner(self,instance):
  21.         handle = open("test.txt", "r")
  22.         data = handle.read()
  23.         handle.close()
  24.        
  25.         if( self.formula1 == "0"):
  26.             self.formula1 = ""  
  27.         self.formula1 = str(data)
  28.         self.update_label1()
  29.        
  30.     def calc_result1(self,instance):
  31.         int  = self.lbl1.text
  32.         int = self.lbl3.text
  33.         self.lbl2.text = str(eval(self.lbl1.text) + eval(self.lbl3.text))
  34.         handle = open("test.txt", "w")
  35.         data = handle.write(self.lbl2.text)
  36.         handle.close()
  37.          
  38.    
  39.     def update_label1(self):
  40.         self.lbl1.text = self.formula1
  41.        
  42.     def update_label(self):
  43.         self.lbl3.text = self.formula
  44.        
  45.        
  46.    
  47.     def add_number(self, instance):
  48.         if( self.formula == "0"):
  49.             self.formula = ""  
  50.         self.formula += str (instance.text)
  51.         self.update_label()
  52.        
  53.        
  54.     def calc_result(self, instance):
  55.         a=16.2
  56.         b=100
  57.         self.lbl4.text = str(eval(self.lbl3.text)*a/100)
  58.         self.formula = "0"
  59.         self.calc_result1
  60.        
  61.    
  62.     def build(self):
  63.         self.formula1 = "0"
  64.         self.formula = "0"
  65.         bl = BoxLayout(orientation ="vertical",padding=10)
  66.         gl = GridLayout(cols=3,spacing=3,size_hint=(1,.6))
  67.        
  68.         self.lbl1 = Label(text="Км было", font_size = 20, size_hint = (1,.1))
  69.         self.lbl2 = Label(text="Км стало", font_size = 20, size_hint = (1,.1))
  70.         self.lbl3 = Label(text="Ты проехал", font_size = 20, size_hint = (1,.1))
  71.         self.lbl4 = Label(text="Ты потратил", font_size = 20, size_hint = (1,.1))
  72.        
  73.         bl.add_widget( self.lbl1)
  74.         bl.add_widget( self.lbl2)
  75.         bl.add_widget( self.lbl3)
  76.         bl.add_widget( self.lbl4)
  77.         bl.add_widget( Button(text="Рачет",on_press = self.calc_result, size_hint = (1,.1)))
  78.        
  79.        
  80.        
  81.         gl.add_widget( Button(text="7",on_press = self.add_number))
  82.         gl.add_widget( Button(text="8",on_press = self.add_number))
  83.         gl.add_widget( Button(text="9",on_press = self.add_number))
  84.        
  85.         gl.add_widget( Button(text="4",on_press = self.add_number))
  86.         gl.add_widget( Button(text="5",on_press = self.add_number))
  87.         gl.add_widget( Button(text="6",on_press = self.add_number))
  88.        
  89.         gl.add_widget( Button(text="1",on_press = self.add_number))
  90.         gl.add_widget( Button(text="2",on_press = self.add_number))
  91.         gl.add_widget( Button(text="3",on_press = self.add_number))
  92.        
  93.         gl.add_widget( Button(text="Cor",on_press = self.ner))
  94.         gl.add_widget( Button(text="0",on_press = self.add_number))
  95.         gl.add_widget( Button(text="Км",on_press = self.calc_result1))
  96.        
  97.         bl.add_widget(gl)
  98.        
  99.         return bl
  100.  
  101.  
  102. if __name__ == "__main__":
  103.     GazApp().run()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top