Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. #imports
  2. from kivy.app import App
  3. from kivy.core.window import Window
  4. from kivy.uix.button import Button
  5. from kivy.uix.floatlayout import FloatLayout
  6. from kivy.uix.gridlayout import GridLayout
  7. from kivy.uix.label import Label
  8. from kivy.uix.scrollview import ScrollView
  9. from kivy.uix.textinput import TextInput
  10. import Functions
  11. import sys
  12. import time
  13.  
  14.  
  15.  
  16. class Home(FloatLayout):
  17. #function that setups the first page
  18. def setup(self, obj):
  19. self.clear_widgets()
  20.  
  21. List = Button(
  22. text="Your List",
  23. font_size=20,
  24. size_hint=(1/6, 1/12),
  25. pos_hint={"x":2.5/6, "y":1/6},
  26. on_press = self.LIISST
  27. )
  28.  
  29.  
  30.  
  31.  
  32. self.add_widget(List)
  33.  
  34.  
  35.  
  36. #function that lists tasks
  37. def LIISST(self, obj):
  38. self.clear_widgets()
  39. FUNC_ = Functions.Choose_("GE", 5)
  40. FUNC_.sort()
  41.  
  42. LT = GridLayout(
  43. cols=1,
  44. spacing=10,
  45. size_hint_y=None,
  46. )
  47. LT.bind(minimum_height=LT.setter('height'))
  48.  
  49. SCR = ScrollView(
  50. size_hint=(1/3.5, 2/3),
  51. pos=(self.width*137/384, self.height/3.25)
  52. )
  53.  
  54.  
  55.  
  56. for i in range(len(FUNC_)):
  57. but_ = Button(text=str(FUNC_[i]),
  58. size_hint=(18/20, None),
  59. height=40,
  60. font_size=self.width/75,
  61. on_press=lambda s:Functions.Choose_("DE", but_.text)
  62. )
  63.  
  64. LT.add_widget(but_)
  65. SCR.add_widget(LT)
  66.  
  67.  
  68.  
  69. ACC_ = Button(
  70. text="Back",
  71. font_size=20,
  72. size_hint=(1/8, 1/14),
  73. pos_hint={"x":3.5/8, "y":1/6},
  74. on_press=self.setup
  75. )
  76.  
  77.  
  78. self.add_widget(SCR)
  79. self.add_widget(ACC_)
  80.  
  81.  
  82.  
  83. def __init__(self, **kwargs):
  84. super(Home, self).__init__(**kwargs)
  85. Window.clearcolor = (255/255, 255/255, 255/255, 255/255)
  86.  
  87.  
  88.  
  89. self.setup(self)
  90.  
  91.  
  92.  
  93. class App_(App):
  94.  
  95. def build(root):
  96. return Home()
  97.  
  98.  
  99.  
  100. if __name__ == '__main__':
  101. App_().run()
  102.  
  103. import random
  104. import sys
  105.  
  106. def Choose_(vall_, VAAL_):
  107. try:
  108.  
  109. #variables
  110. cfile = open(r"Choice.txt", "r+")
  111. cfile.seek(0)
  112. dfile = open(r"Done.txt", "r+")
  113. dfile.seek(0)
  114. items = []
  115. DON = []
  116.  
  117. #appenders for items in file to line
  118. [items.append(line) for line in cfile]
  119. [DON.append(line) for line in dfile]
  120.  
  121. stripp1 = [s.strip() for s in items]
  122. stripp2 = [s.strip() for s in DON]
  123.  
  124. stripp1.sort()
  125. stripp2.sort()
  126.  
  127. if vall_ == "DE":
  128. print(VAAL_)
  129.  
  130. if vall_ == "GE":
  131. return stripp1
  132. sys.exit()
  133.  
  134. for s in stripp2:
  135. if s in stripp1:
  136. stripp1.remove(s)
  137.  
  138. if not stripp1:
  139. dfile.seek(0)
  140. dfile.truncate(0)
  141. return False
  142. sys.exit()
  143.  
  144.  
  145. luck = random.randint(0, (len(stripp1)-1))
  146.  
  147. dfile.write(stripp1[luck])
  148. dfile.write("n")
  149.  
  150. return(stripp1[luck])
  151. finally:
  152. cfile.close()
  153. dfile.close()
  154.  
  155. ClIP STUDIO PAINT
  156. CYBRARY (HACKING)
  157. CYBRARY (LINUX)
  158. VIRTUAL DJ
  159. RASPBERRY PI
  160. PACKET TRACER
  161. VIRTUALBOX
  162. PHOTOSHOP
  163. BLENDER
  164. SOLIDWORKS
  165. KHAN ACADEMY (ANATOMY)
  166. SOLOLEARN
  167. UNITY
  168. KHAN ACADEMY (ELECTRICAL)
  169. PROGRAMMING
  170. KHAN ACADEMY (PHYSICS)
  171. ADOBE PREMIERE
  172.  
  173. ClIP STUDIO PAINT
  174. CYBRARY (HACKING)
  175. CYBRARY (LINUX)
  176. VIRTUAL DJ
  177. RASPBERRY PI
  178. PACKET TRACER
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement