Advertisement
Guest User

Debate Assistant Appjar

a guest
Dec 14th, 2017
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.18 KB | None | 0 0
  1. from appJar import gui
  2. import time as t
  3.  
  4. app = gui('Debate Assistant')
  5.  
  6. def committee(x):
  7.     print("ran 'committee'")
  8.     global committee
  9.     is_committee = True
  10.     app.removeAllWidgets()
  11.     app.addLabelOptionBox('committee component', ['Senate Committee', 'House Committee'])
  12.     app.setLabel('committee component', 'Is this a House or Senate committee?')
  13.     app.addLabelOptionBox('committee number', ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'])
  14.     app.setLabel('committee number', 'Select your committee number')
  15.     app.addButton('committee debate', next_committee)
  16.     app.setButton('committee debate', 'Next')
  17.     print(is_committee)
  18.  
  19.  
  20. def next_committee(x):
  21.     print("ran 'next_committee'")
  22.     global committee_number
  23.     global committee_component
  24.     committee_number = app.getOptionBox('committee number')
  25.     committee_component = app.getOptionBox('committee component')
  26.     print(committee_component, committee_number)
  27.     committee_debate(None)
  28.  
  29.  
  30. def committee_debate(x):
  31.     print("ran 'Committee debate'")
  32.     app.removeAllWidgets()
  33.     app.addLabelOptionBox('committee bills', bills[int(committee_number) - 1])
  34.     app.setLabel('committee bills', 'Bill:')
  35.     app.addButton('next committee debate', next_committee_debate)
  36.     app.setButton('next committee debate', 'Next')
  37.  
  38.  
  39. def next_committee_debate(x):
  40.     global current_bill
  41.     print("ran 'next_committee_debate'")
  42.     current_bill = app.getOptionBox('committee bills')
  43.     introduction_bill(x)
  44.  
  45.  
  46. def introduction_bill(x):
  47.     global time_remaining, time_allotted
  48.     time_remaining = 120
  49.     time_allotted = 120
  50.     app.removeAllWidgets()
  51.     print("ran 'introduction_bill'")
  52.     app.addLabel('timer', 'Time remaining: 2:00')
  53.     app.addButtons(['start timer','update'], [start_timer, update_timer])
  54.     app.addButton('next introduction', next_introduction)
  55.  
  56.  
  57. def next_introduction(x):
  58.     print("ran'next_introduction'")
  59.  
  60.  
  61. def update_timer():
  62.     global time_remaining, current_function
  63.     current_function = 'update timer'
  64.     time_remaining = end_time - t.time()
  65.     minutes = int(time_remaining // 60)
  66.     seconds = round(time_remaining % 60, 2)
  67.     app.setLabel('timer', 'Timer remaining: ' + str(minutes) + ':' + str(seconds))
  68.     print("ran 'update_timer'")
  69.     if time_remaining > -10:
  70.         app.registerEvent(update_timer)
  71.  
  72.  
  73. def start_timer(x):
  74.     print("ran 'start_timer'")
  75.     global start_time, end_time
  76.     start_time = t.time()
  77.     end_time = start_time + time_allotted
  78.     update_timer()
  79.  
  80.  
  81. def ga(a):
  82.     print("ran 'General Assembly'")
  83.  
  84.  
  85. bills = [['BSB/18-1-1', 'BSB/18-1-2', 'RSB/18-1-3', 'BSB/18-1-4'],
  86.          ['BSB/18-2-1', 'BSB/18-2-2', 'RSB/18-2-3', 'BSB/18-2-4']]
  87.  
  88. is_committee = False
  89. committee_component = None
  90. committee_number = None
  91. current_bill = None
  92. start_time = 0
  93. end_time = 0
  94. time_remaining = 0
  95. current_function = None
  96. general_assembly = False
  97. time_allotted = 120
  98.  
  99. app.addLabel('timer', '')
  100. app.addLabel('welcome', 'Welcome to the Debate Assistant!')
  101. app.addLabel('com or ga', 'Please select if you are in committee or General Assembly')
  102. app.addButtons(['Committee', 'General Assembly'], [committee, ga])
  103.  
  104. app.go()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement