zhongnaomi

guizero -Adult Placement Test for English Classes

Sep 11th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.16 KB | None | 0 0
  1. # guizero -Adult Placement Test for English Classes
  2. from guizero import App, Text,PushButton,Box
  3. app = App(title="Adult Placement Test for English Classes",width = 500,height=800)
  4.  
  5. score = 0
  6.    
  7. # Function definitions for your events go here.
  8. def a123():
  9.     score = 0
  10.     if buttonb.text =="A":
  11.         score += 1
  12.     else:
  13.         score += 0
  14.     questionmessage.value = "next Q2"
  15.     buttona.text="next A2"
  16.     buttonb.text="next B2"
  17.     buttonc.text="next C2"
  18.     buttond.text="next D2"
  19. def b123():
  20.     score = 0
  21.     if buttonb.text =="A":
  22.         score += 1
  23.     else:
  24.         score += 0
  25.     questionmessage.value = "next Q2"
  26.     buttona.text="next A2"
  27.     buttonb.text="next B2"
  28.     buttonc.text="next C2"
  29.     buttond.text="next D2"
  30. def c123():
  31.     score = 0
  32.     if buttona.text =="A":
  33.         score += 1
  34.     else:
  35.         score += 0
  36.     buttona.text="next A2"
  37.     buttonb.text="next B2"
  38.     buttonc.text="next C2"
  39.     buttond.text="next D2"
  40.     questionmessage.value = "next Q2"
  41. def d123():
  42.     score = 0
  43.     if buttonb.text =="A":
  44.         score += 1
  45.     questionmessage.value = "next Q2"
  46.     buttona.text="next A2"
  47.     buttonb.text="next B2"
  48.     buttonc.text="next C2"
  49.     buttond.text="next D2"
  50. def next():
  51.     nextbutton.text=score
  52.    
  53.  
  54. # Your GUI widgets go here  
  55. box_timer =Box(app, width = "fill", border=0,height=50)
  56.  
  57. box_question=Box(app, width = "fill", border=0,height=200)
  58.  
  59. box_a=Box(app, width = "fill", border=0,height=80)
  60. box_b=Box(app, width = "fill", border=0,height=80)
  61. box_c=Box(app, width = "fill", border=0,height=80)
  62. box_d=Box(app, width = "fill", border=0,height=80)
  63. box_next=Box(app, width = "fill", border=0,height=50)
  64.  
  65. timemessage =  Text(box_timer, text="You have 20 minutes left")
  66.  
  67. questionmessage = Text(box_question, text="I ----- some friends for dinner last night.")
  68. questionmessage.text_size=16
  69. questionmessage.font = "Arial Black"
  70. buttona=PushButton(box_a,text="A",command=a123)
  71. buttonb=PushButton(box_b,text="B",command=b123)
  72. buttonc=PushButton(box_c,text="C",command=c123)
  73. buttond=PushButton(box_d,text="D",command=d123)
  74.  
  75.  
  76. nextbutton= PushButton(box_next,text = "Next",command=next)
  77.  
  78.  
  79. # Show the GUI on the screen, start listening to events.
  80. app.display()
Add Comment
Please, Sign In to add comment