diff options
author | Alex <acj3840@rit.edu> | 2010-06-30 18:21:44 (GMT) |
---|---|---|
committer | Alex <acj3840@rit.edu> | 2010-06-30 18:21:44 (GMT) |
commit | 6195a384618738fdddff59b0f23f0b85f537a57d (patch) | |
tree | 4a732eed6c5496f1cc4b4ec3bde3b1a351c61e01 | |
parent | bbf28dacac5e92d05cdfe92825af36757fb41d64 (diff) |
finished the 1st screen of teachers GUI and added some slight formatting to students GUI
also hooked up the teacher button to create a student button when clicked
-rw-r--r-- | PopQuiz.activity/popquiz.py | 87 |
1 files changed, 76 insertions, 11 deletions
diff --git a/PopQuiz.activity/popquiz.py b/PopQuiz.activity/popquiz.py index 20c4ce6..788bf26 100644 --- a/PopQuiz.activity/popquiz.py +++ b/PopQuiz.activity/popquiz.py @@ -63,10 +63,24 @@ class Student: textviewtimer = gtk.TextView() textviewtimer.show() textbuffertimer = textviewtimer.get_buffer() - textbuffertimer.set_text("Timer :60") + textbuffertimer.set_text("Timer:") + textviewtimer.set_editable(False) + textviewtimer.set_cursor_visible(False) + textviewtimer.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("grey")) + + #create and pack timerentry + timerentry = gtk.Entry() + timerentry.show() + timerentry.set_editable(False) + + #vboxtimer to hold time info + vboxtimer = gtk.VBox() + vboxtimer.show() + vboxtimer.pack_start(textviewtimer, False, True, 10) + vboxtimer.pack_start(timerentry, False, True, 10) - #pack textbuffertimer into hboxtop aligned right - hboxtop.pack_start(textviewtimer, False, False, 10) + #pack vboxtimer into hboxtop aligned right + hboxtop.pack_start(vboxtimer, False, False, 10) #add hboxtop to vbox1 (child, expand, fill, padding) vboxholdsall.pack_start(hboxtop, True, True, 10) @@ -113,7 +127,7 @@ class Student: hboxbottomhalf.pack_start(self.button, True, True, 10) #add bottom half to whole screen - vboxholdsall.pack_start(hboxbottomhalf, True, True, 10) + vboxholdsall.pack_start(hboxbottomhalf, False, True, 10) #add vboxholdsall to window self.window.add(vboxholdsall) @@ -140,6 +154,10 @@ class Teacher: def destroy(self, widget, data = None): gtk.main_quit() + + def createstudent(self, widget, data = None): + student = Student() + student.main() def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) @@ -187,23 +205,70 @@ class Teacher: timertextview.set_cursor_visible(False) timertextbuffer = timertextview.get_buffer() timertextbuffer.set_text("Timer (in seconds): ") + timertextview.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("grey")) - #add timer label to box + #create entry where time will actually be + timerentry = gtk.Entry() + timerentry.show() + timerentry.set_editable(True) + + #add timer label and timer entry to box vboxtimer = gtk.VBox() vboxtimer.show() vboxtimer.pack_start(timertextview, False, True, 10) - - #create and add space for timer entry - timerentry = gtk.Entry() - timerentry.show() - timertext = timerentry.get_text() vboxtimer.pack_start(timerentry, False, True, 10) #add vboxtimer to hboxtop hboxtop.pack_start(vboxtimer, False, True, 10) - #add hboxtop to vboxholdsall + #hboxbottom to hold the bottom half of the screen + hboxbottom = gtk.HBox() + hboxbottom.show() + + #create a correct answer box and 3 incorrect answer boxes + correctentry = gtk.Entry() + wrong1entry = gtk.Entry() + wrong2entry = gtk.Entry() + wrong3entry = gtk.Entry() + correctentry.set_text("Correct answer here") + wrong1entry.set_text("Incorrect answer here") + wrong2entry.set_text("Incorrect answer here") + wrong3entry.set_text("Incorrect answer here") + correctentry.show() + wrong1entry.show() + wrong2entry.show() + wrong3entry.show() + + #boxes to hold the answers + hboxanswers = gtk.HBox() + hboxanswers.show() + vboxanswers1 = gtk.VBox() + vboxanswers1.show() + vboxanswers2 = gtk.VBox() + vboxanswers2.show() + + #pack answer fields into boxes + vboxanswers1.pack_start(correctentry, True, True, 10) + vboxanswers1.pack_start(wrong1entry, True, True, 10) + vboxanswers2.pack_start(wrong2entry, True, True, 10) + vboxanswers2.pack_start(wrong3entry, True, True, 10) + hboxanswers.pack_start(vboxanswers1, True, True, 10) + hboxanswers.pack_start(vboxanswers2, True, True, 10) + + #create send button + sendbutton = gtk.Button("Send Question") + sendbutton.show() + + #connect button + sendbutton.connect("clicked", self.createstudent) + + #pack hboxbottom + hboxbottom.pack_start(hboxanswers, True, True, 10) + hboxbottom.pack_start(sendbutton, True, True, 10) + + #pack vboxholdsall vboxholdsall.pack_start(hboxtop, True, True, 10) + vboxholdsall.pack_start(hboxbottom, False, True, 10) #add vboxholdsall to window self.window.add(vboxholdsall) |