Advertisement
gregwa

Transposer 0.1

Aug 8th, 2012
401
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import kivy
  2. kivy.require('1.0.8')
  3. from sys import exit
  4. from kivy.app import App
  5. from kivy.core.window import Window
  6. from kivy.uix.button import Button
  7. from kivy.uix.label import Label
  8. from kivy.uix.anchorlayout import AnchorLayout
  9. from kivy.uix.scrollview import ScrollView
  10. from kivy.uix.gridlayout import GridLayout
  11.  
  12. class Transpose(App):
  13.     def exit(instance):
  14.         sys.exit()
  15.        
  16.     def build(self):
  17.         #--------------------------------------------------------------
  18.         text1 = "  C  C#/Db  D  D#/Eb  E    F  F#/Gb  G  G#/Ab  A  A#/Bb  B    C"
  19.         text2 = "  C  C#/Db  D  D#/Eb  E    F  F#/Gb  G  G#/Ab  A  A#/Bb  B    C  C#/Db  D  D#/Eb  E    F  F#/Gb  G  G#/Ab  A  A#/Bb  B    C  C#/Db"
  20.         #--------------------------------------------------------------
  21.         root = GridLayout(orientation='vertical', spacing=10, cols=1,rows=3)
  22.         lbl = Label(text='Transposer Ver 0.7',font_size=20,size_hint=(None,None),size=(480,20),padding=(10,10))
  23.         btn1 = Button(text = "  " + text1,size=(680,40),size_hint=(None, None),halign='left',font_name='data/fonts/DroidSansMono.ttf',padding=(20,20))
  24.  
  25.         #--------------------------------------------------------------
  26.         root.add_widget(lbl)
  27.         root.add_widget(btn1)
  28.         #--------------------------------------------------------------
  29.         s = GridLayout(cols=1, spacing = 10, size_hint_y = None)
  30.         s.bind(minimum_height=s.setter('height'))
  31.         for i in range(0,19):
  32.             if i <= 12:
  33.                 if i < 10:
  34.                     t1 = " " + str(i) + "| "
  35.                 else:
  36.                     t1 = str(i) + "| "
  37.             else:
  38.                 t1 = ''
  39.                 text2 = ''
  40.             btn = Button(text=t1+text2[(i*5):(i*5)+65], size=(680, 40),
  41.                          size_hint=(None, None),halign='left',font_name='data/fonts/DroidSansMono.ttf')
  42.  
  43.             s.add_widget(btn)
  44.         #--------------------------------------------------------------
  45.         sv = ScrollView(size_hint=(None, None), size=(600,400))
  46.  
  47.         sv.center = Window.center
  48.         root.add_widget(sv)
  49.         sv.add_widget(s)
  50.  
  51.         return root
  52.        
  53. if __name__ in ('__main__','__android__'):
  54.     Transpose().run()
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement